perezf Posted February 22, 2009 Share Posted February 22, 2009 I have this query that i want to have all my items list in this specified order where i have list_zip How can i do this for some reason it is just showing everything just not in this order, SELECT * FROM snm_listings WHERE `list_country`='US' AND ( `list_zip`='33331' || `list_zip`='33330' || `list_zip`='33326' || `list_zip`='33332' || `list_zip`='33028' || `list_zip`='33325' || `list_zip`='33327' || `list_zip`!=NULL) Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/ Share on other sites More sharing options...
gevans Posted February 22, 2009 Share Posted February 22, 2009 use the field that you want to order by: SELECT `something` WHERE `somthing_else`='another_thing' ORDER BY `something` Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/#findComment-768147 Share on other sites More sharing options...
perezf Posted February 22, 2009 Author Share Posted February 22, 2009 I need to do like a custom sort for instance, Say i have the numbers 1,2,3,4,5,6 And i want to sort them like this 4,2,3,6,1,5 Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/#findComment-768149 Share on other sites More sharing options...
gevans Posted February 22, 2009 Share Posted February 22, 2009 Do you know what you're getting back from your query? are you sorting alphabetically, numerically? or just a random order that you want to dictate? Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/#findComment-768150 Share on other sites More sharing options...
Cosizzle Posted February 22, 2009 Share Posted February 22, 2009 SELECT * FROM snm_listings WHERE `list_country`='US' AND ( `list_zip`='33331' || `list_zip`='33330' || `list_zip`='33326' || `list_zip`='33332' || `list_zip`='33028' || `list_zip`='33325' || `list_zip`='33327' || `list_zip`!=NULL ) ORDER BY list_zip ASC Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/#findComment-768151 Share on other sites More sharing options...
perezf Posted February 22, 2009 Author Share Posted February 22, 2009 works great thanks Link to comment https://forums.phpfreaks.com/topic/146314-solved-mysql-order/#findComment-768162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.