guitarist809 Posted March 20, 2007 Share Posted March 20, 2007 Hello, Is there a way to do a query like this? SELECT `field1`,`field2`,`field3` FROM `mytable` WHERE `field1` = 1 OR WHERE `field1` = 2 OR WHERE `field1` = 8 If you didn't get what I was trying to do I'm trying to select some rows where "field1" can either be 1, 2, or 8. How can I do this? Thanks, -Matt Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 21, 2007 Share Posted March 21, 2007 ... WHERE `field` IN (1,2, Quote Link to comment Share on other sites More sharing options...
artacus Posted March 21, 2007 Share Posted March 21, 2007 Yep and if you need to add additional where clauses, you separate them with either AND or OR but you only use WHERE on the first one. Quote Link to comment Share on other sites More sharing options...
guitarist809 Posted March 21, 2007 Author Share Posted March 21, 2007 Sweet thx! [solved] 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.