streetwitch Posted July 19, 2011 Share Posted July 19, 2011 Hi - I'm fairly new to using php and mysql and am hoping that this is a simple question. I need to do what I would describe as a nested sort order: I have a list of names which I want to sort firstly by a flag, and secondly in alphabetical order.Here's my code:$query_artists = "SELECT artist_id, artist_name, `new` FROM artists WHERE setting_flag = 'S' ORDER BY artist_name ASC";So I want to order by a field called 'new' (and alphabetically for all records with the flag), and then the remainder alphabetically.Can anyone help? Link to comment Share on other sites More sharing options...
Ingolme Posted July 19, 2011 Share Posted July 19, 2011 ORDER BY new, artist_name ASC Link to comment Share on other sites More sharing options...
streetwitch Posted July 19, 2011 Author Share Posted July 19, 2011 ORDER BY new, artist_name ASC Link to comment Share on other sites More sharing options...
streetwitch Posted July 19, 2011 Author Share Posted July 19, 2011 ORDER BY new, artist_name ASC Ah...even simpler than I thought! Thanks very much - I'd tried to google it but hadn;t been able to find an example. Working perfectly. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.