DanDaBeginner Posted December 12, 2008 Share Posted December 12, 2008 how can sort the countries by ASC but with USA and Canada being the first.... I guess it will be something like: SELECT * FROM countries ORDER BY (country_name IN ('USA','CANADA')) ASC, country_name DESC.. Thanks in advance... Link to comment https://forums.phpfreaks.com/topic/136618-solved-order-by-statement/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 12, 2008 Share Posted December 12, 2008 Should work - SELECT * FROM countries ORDER BY FIELD(country_name, 'Canada', 'USA') DESC, country_name Ref: http://cakebaker.42dh.com/2008/06/10/order-by-field/ Link to comment https://forums.phpfreaks.com/topic/136618-solved-order-by-statement/#findComment-713345 Share on other sites More sharing options...
xtopolis Posted December 12, 2008 Share Posted December 12, 2008 Nice, I had no idea about this. Link to comment https://forums.phpfreaks.com/topic/136618-solved-order-by-statement/#findComment-713354 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.