dannybrazil Posted September 16, 2009 Share Posted September 16, 2009 Hello I was wondering , can i do this : ORDER BY name AND id ASC ? i want it to be ordered alphabetically and by id (from 1 and up) thanks Link to comment https://forums.phpfreaks.com/topic/174454-solved-order-by/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 16, 2009 Share Posted September 16, 2009 I'm not sure what you are asking, but the answer is probably - ORDER BY name, id Posting an example of what the data is and what the desired output is would help. Link to comment https://forums.phpfreaks.com/topic/174454-solved-order-by/#findComment-919469 Share on other sites More sharing options...
gevans Posted September 16, 2009 Share Posted September 16, 2009 Your syntax would need to be as followed; SELECT * FROM `table` ORDER BY `name` ASC, `id` ASC This would order everything by the `name` field. Any identical `name` fields would then be further ordered via their `id` field. Link to comment https://forums.phpfreaks.com/topic/174454-solved-order-by/#findComment-919470 Share on other sites More sharing options...
dannybrazil Posted September 16, 2009 Author Share Posted September 16, 2009 thats it... thanks Link to comment https://forums.phpfreaks.com/topic/174454-solved-order-by/#findComment-919478 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.