Re: Sorting by numerical order

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: Sorting by numerical order
Дата
Msg-id 20040315070406.GA1645@zf.jcu.cz
обсуждение исходный текст
Ответ на Re: Sorting by numerical order  (Mike Nolan <nolan@gw.tssi.com>)
Список pgsql-general
On Sun, Mar 14, 2004 at 04:59:45PM -0600, Mike Nolan wrote:
> > CSN wrote:
> > > Is it possible to have items sorted like:
> > >
> > > abc 1
> > > abc 2
> > > abc 10
> > > abc 20
> >
> > Cast them to a numeric type.
>
> You can't cast a variable char type to a numeric, though apparently

 You can:

test=# select to_number('abc 1', '"abc "99');
 to_number
-----------
         1
(1 row)

test=# select to_number('abc 20', '"abc "99');
 to_number
-----------
        20
(1 row)


    Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Nolan
Дата:
Сообщение: Re: Sorting by numerical order
Следующее
От: Edwin Pauli
Дата:
Сообщение: Re: PostgeSQL problem (server crashed?)