JamesRyzon Posted July 7, 2006 Share Posted July 7, 2006 Having some trouble with mysql statements wanting to run multiple types at once this is an example[code]SELECT * FROM cars WHERE Year='$year' AND Model='Ford' OR 'GM'[/code]Just as an exmaple, the query only returns cars from 1990 and Ford type, skipping GM.Any helpful hints on this? Quote Link to comment Share on other sites More sharing options...
effigy Posted July 7, 2006 Share Posted July 7, 2006 ...AND Model='Ford' OR Model='GM'Which could also be expressed:...AND Model IN ('Ford', 'GM') Quote Link to comment Share on other sites More sharing options...
JamesRyzon Posted July 7, 2006 Author Share Posted July 7, 2006 Thank you for your quick reply!That was exactily what i was looking for but I didnt know about "IN" in sql, thanks again! Quote Link to comment Share on other sites More sharing options...
fenway Posted July 7, 2006 Share Posted July 7, 2006 If you didn't use IN(), you should probably use parens to make it explicit. 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.