homepage Welcome to WebmasterWorld Guest from 107.21.163.227
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Help with ORDER BY statement
Jakotsu




msg:3370592
 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!

 

phranque




msg:3370680
 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)

joelgreen




msg:3371044
 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.

Jakotsu




msg:3371502
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved