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) Quote Link to comment 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` Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
perezf Posted February 22, 2009 Author Share Posted February 22, 2009 works great thanks Quote Link to comment 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.