ORDER BY question

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
Grant Henderson [ Do, 27 Februar 2003 11:09 ] [ ID #31338 ]

Re: ORDER BY question

>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
adriantineo [ Do, 27 Februar 2003 11:54 ] [ ID #31339 ]
Datenbanken » gmane.comp.db.postgresql.php » ORDER BY question

Vorheriges Thema: PL/PGSQL
Nächstes Thema: list archive