ORDER BY question

ORDER BY question

am 27.02.2003 11:09:58 von Grant Henderson

I have a field with names in which I wish to sort using ORDER BY.

The data comes back as [A-Z][a-z]
Apple
Blackberry
Kiwi
aardvark
banana

It should be [Aa-Zz]
aardvark
Apple
banana
Blackberry
Kiwi

They seem to be sorting using the ASCII equivelant.

Is there any way to do a case insensitive sort?.

Thanks in advance
Grant

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: ORDER BY question

am 27.02.2003 11:54:06 von adriantineo

>Is there any way to do a case insensitive sort?.

Try:
SELECT colum_name
FROM table_name
ORDER BY upper(colum_name);

For a list of support functios like upper() check this url:
http://www.postgresql.org/docs/aw_pgsql_book/node92.html

_________
Adrian Tineo


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html