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? Link to comment https://forums.phpfreaks.com/topic/13911-mysql-multiple-statements/ 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') Link to comment https://forums.phpfreaks.com/topic/13911-mysql-multiple-statements/#findComment-54176 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! Link to comment https://forums.phpfreaks.com/topic/13911-mysql-multiple-statements/#findComment-54183 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. Link to comment https://forums.phpfreaks.com/topic/13911-mysql-multiple-statements/#findComment-54249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.