Jim R Posted May 9, 2014 Share Posted May 9, 2014 Here is the query: $query = 'SELECT * FROM a_playerRank WHERE year="2015" and position="1" and grouping<4 ORDER BY grouping DESC,rankPos,region,nameLast'; I have three groups (grouping). The first group is based on their ranking 1-10 or 1-15. (working fine) The second group is supposed to be alphabetical based on last name. (not working) The third group is supposed to be based on region, then alphabetically by their last name, and I have a header for each region. (working fine) I attached an image of grouping two and three. Group two (top group in the picture) isn't alphabetical. I know why the query isn't producing what I want, but I can't figure out the query I need to get my list to show as I described it. It shows the second group ordered by region then last name, just without headers. When I flip region and nameLast in the order by, the second group works great, but the third group basically produces a header for each kid (it looks like a mess). I assume there is a more complex query that will produce what I want. Quote Link to comment https://forums.phpfreaks.com/topic/288357-having-issues-with-my-order-by/ Share on other sites More sharing options...
Jim R Posted May 9, 2014 Author Share Posted May 9, 2014 I'm searching for complex order by queries. Is this an issue where "case" would work? Quote Link to comment https://forums.phpfreaks.com/topic/288357-having-issues-with-my-order-by/#findComment-1478831 Share on other sites More sharing options...
Solution Jim R Posted May 9, 2014 Author Solution Share Posted May 9, 2014 Never mind, I found my solution. I tried to edit my post, but too much time had past. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/288357-having-issues-with-my-order-by/#findComment-1478835 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.