Re: numeric SORT order

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: numeric SORT order
Дата
Msg-id m3y9ih6uaj.fsf@varsoon.denali.to
обсуждение исходный текст
Ответ на Re: numeric SORT order  (Ben Ausden <benedict@navyblue.com>)
Список pgsql-general
Ben Ausden <benedict@navyblue.com> writes:

> thanks Mitch.
> the problem is that casting to int won't work for non-numeric data
> (obviously), and I can't guarantee that values in this column will
> definitely be numeric... I should have made that clearer in my post. Ideally
> I'd like to sort numbers in numeric order and text in regular alphabetic
> order, like: 1,2,3,40,50,a,b,c,d,e...[etc]

Then you'll need to write a custom comparison operator and do
"ORDER BY ... USING my_op".

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

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

Предыдущее
От: Jeff Eckermann
Дата:
Сообщение: Re: numeric SORT order
Следующее
От: "Peter Darley"
Дата:
Сообщение: Re: Moving my business to PostgreSQL