homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Help with ORDER BY statement

 3:05 am on Jun 18, 2007 (gmt 0)

For some reason the ORDER BY clause sort mode is case sensitive, that is, it "sorts" uppercase fields firts and lower case fields at the end.

Is there some way to specify a case insensitive sorting? Thanks!



 6:24 am on Jun 18, 2007 (gmt 0)

you didn't really state which database or field type you are using, but in general you can try folding all column values to one case such as:
SELECT text_column FROM some_table ORDER BY UPPER(text_column)


 1:56 pm on Jun 18, 2007 (gmt 0)

This can be very slow on big tables because mysql will have to loop through each record uppercasing it. In this case you may consider saving uppercased values in separate indexed field and use it in where clause.

But above suggestions should be ok if table has not much data.


 9:17 pm on Jun 18, 2007 (gmt 0)

Thanks, I think that should work because table won´t be big initially, abnd the default sort mode will be date instead of name.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved