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 [EMAIL PROTECTED] Phone: (253) 798-3549 Pager: (253) 754-0002 >>> "Clark Endrizzi" <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html