jordanwb Posted March 11, 2008 Share Posted March 11, 2008 I'm making a PHP based Jukebox. I have a table which holds singers and I want them to be sorted by their name. However I have a problem: Aaron Pritchett Aaron Tippin Which comes first? Aaron Pritchett should because "P" comes before "T" but "Tippin" is shorter than "Pritchett". So I'd like to know how MySQL would sort names like these. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/95616-how-does-mysql-sort-strings/ Share on other sites More sharing options...
fenway Posted March 11, 2008 Share Posted March 11, 2008 There are a variety of hacks... but the best solution is to split first from last. Quote Link to comment https://forums.phpfreaks.com/topic/95616-how-does-mysql-sort-strings/#findComment-489580 Share on other sites More sharing options...
jordanwb Posted March 11, 2008 Author Share Posted March 11, 2008 I found out that MySQL sorts strings by the value of the letters in the string, so Aaron Pritchett will come before Aaron Tippin. Quote Link to comment https://forums.phpfreaks.com/topic/95616-how-does-mysql-sort-strings/#findComment-489740 Share on other sites More sharing options...
fenway Posted March 11, 2008 Share Posted March 11, 2008 Sorry, I misunderstood your question. Quote Link to comment https://forums.phpfreaks.com/topic/95616-how-does-mysql-sort-strings/#findComment-489784 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.