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 Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/ 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 Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-499742 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. Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-500510 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. Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-500579 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 Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-501095 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 Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-501241 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! Link to comment https://forums.phpfreaks.com/topic/97575-sql-help/#findComment-502098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.