Re: Natural ordering in postgresql? Does it exist?

Поиск
Список
Период
Сортировка
От Ian Harding
Тема Re: Natural ordering in postgresql? Does it exist?
Дата
Msg-id s1b9d582.024@MAIL.TPCHD.ORG
обсуждение исходный текст
Ответ на Natural ordering in postgresql? Does it exist?  ("Clark Endrizzi" <clarkendrizzi@hotmail.com>)
Список pgsql-general
Numbers as text are ordered like that.  Integers are ordered as you would like.

The best hack I have seen if you are stuck with text is

...order by length(numbers_as_test), numbers_as_text

which sorts first by number of "digits" then by text order.

Ian Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
iharding@tpchd.org
Phone: (253) 798-3549
Pager: (253) 754-0002

>>> "Clark Endrizzi" <clarkendrizzi@hotmail.com> 12/10/04 1:47 PM >>>
Hi all,
I have a field that I'll be ordering and  I noticed that ordering is done
logically and would confuse my users here (1,12,16,4,8, etc).

I'm writing an application in PHP that connects to Postgres and while I know
that PHP has some powerful natural ordering functions it would be much
easier if I could just use something from postgres directly.  Does there
exist any way to order naturally?

Thanks,
Clark Endrizzi

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee®
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


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

Предыдущее
От: Paul Tillotson
Дата:
Сообщение: Re: Performance tuning on RedHat Enterprise Linux 3
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: Natural ordering in postgresql? Does it exist?