Re: Sorting by numerical order

Поиск
Список
Период
Сортировка
Искать
От
Karel Zak
Тема
Re: Sorting by numerical order
Дата
Msg-id
20040315070406.GA1645@zf.jcu.cz
Ответ на
Список
Дерево обсуждения
Re: Sorting by numerical order George Essig <george_essig@yahoo.com>
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  
 http://home.zf.jcu.cz/~zakkr/
В списке pgsql-general по дате отправления
От: Mike Nolan
Дата:
Сообщение: Re: Sorting by numerical order
От: Edwin Pauli
Дата:
FAQ