moon 111 Posted March 24, 2008 Share Posted March 24, 2008 I have a table. One of the fields is title. I want to sort it by title in LOWERCASE becasue some are in lower case and others in uppercase and the lower case ones are gettting listed on the top when I sort them. This is my code now: SELECT * FROM site ORDER BY title ASC Could I write something like this? SELECT * FROM site ORDER BY LOWER(title) ASC thanks Quote Link to comment Share on other sites More sharing options...
Barand Posted March 24, 2008 Share Posted March 24, 2008 surely it would be quicker to try it than post here and wait for a reply Quote Link to comment Share on other sites More sharing options...
aschk Posted March 25, 2008 Share Posted March 25, 2008 Doesn't it depend on your collation and charset? Instead of lower() i think you can use binary() , and lower might not differentiate between collations, i.e. SQL = sql . Just a guess, give it a try of course to find out. Quote Link to comment Share on other sites More sharing options...
Barand Posted March 25, 2008 Share Posted March 25, 2008 Binary will force a normally case insensitive search to be case-sensitive. Quote Link to comment Share on other sites More sharing options...
aschk Posted March 26, 2008 Share Posted March 26, 2008 Doesn't that mean it'll work in this situation? Maybe I should do a test myself Quote Link to comment Share on other sites More sharing options...
Barand Posted March 26, 2008 Share Posted March 26, 2008 Binary is to distinguish between UC and LC. That's the exact opposite of what is wanted in this case Quote Link to comment Share on other sites More sharing options...
aschk Posted March 27, 2008 Share Posted March 27, 2008 Ah yes, just re-read the question. Whoops! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.