cooldude832 Posted January 20, 2008 Share Posted January 20, 2008 I am trying to test for certain postings in my table that have a zip code equal to a larege list of zip codes so my query would look like select myfield from `postings` where zip = '12345' || zip = '45678' || zip = '166666' etc. etc. AND USER = $userid There is my problem I want it to be any of those zip but the user must be that user id, so if I have || || || it will be true on any user so long as it finds a matching zip right? can I do something like select myfield from `postings` where zip = ('12345' || '45678' || '66666') AND USER = $userid But I dont know the proper sytnax Link to comment https://forums.phpfreaks.com/topic/86969-solved-where-with-a-large-series-of-zip-codes/ Share on other sites More sharing options...
pocobueno1388 Posted January 21, 2008 Share Posted January 21, 2008 You need to use the "IN" syntax. So try this SELECT myfield FROM `postings` WHERE zip IN('12345', '45678', '66666') AND USER = $userid Link to comment https://forums.phpfreaks.com/topic/86969-solved-where-with-a-large-series-of-zip-codes/#findComment-444686 Share on other sites More sharing options...
cooldude832 Posted January 21, 2008 Author Share Posted January 21, 2008 that was what I was lookign for Link to comment https://forums.phpfreaks.com/topic/86969-solved-where-with-a-large-series-of-zip-codes/#findComment-444688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.