Aureole Posted October 5, 2007 Share Posted October 5, 2007 Is it possible to order a MYSQL result by say what a field contains, like say I have a table and in it is a field called "field". That field can either be 1 or 0 and I want the ones that have a 1 to show first then the ones that are 0 to come after... does that make sense? Quote Link to comment https://forums.phpfreaks.com/topic/71906-solved-ordering-mysql-results/ Share on other sites More sharing options...
cmgmyr Posted October 5, 2007 Share Posted October 5, 2007 SELECT * FROM `your_table` WHERE this = this ORDER BY `your_column` DESC OR SELECT * FROM `your_table` WHERE this = this ORDER BY `your_column` DESC, `your_second_column` DESC Quote Link to comment https://forums.phpfreaks.com/topic/71906-solved-ordering-mysql-results/#findComment-362234 Share on other sites More sharing options...
Aureole Posted October 5, 2007 Author Share Posted October 5, 2007 Yeah after a while at looking at my question I realized that how stupid my question was and how easy to do it actually as... just at the time I figured there'd be a different way to do it... eh that's what you get for trying to code at 5 am, thanks anyway. Quote Link to comment https://forums.phpfreaks.com/topic/71906-solved-ordering-mysql-results/#findComment-362586 Share on other sites More sharing options...
cmgmyr Posted October 5, 2007 Share Posted October 5, 2007 hey, no problem...happens to the best of us! Quote Link to comment https://forums.phpfreaks.com/topic/71906-solved-ordering-mysql-results/#findComment-362621 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.