Kelset Posted May 18, 2006 Share Posted May 18, 2006 Hello All!I hate to be bugging you folks but I have a newbie question that I can not seem to figure out.I have a DB with fields (name,dis,S,F,W,state) the S,W,F are set to enum ('true','false'). Ok now the query I need to run on this is what has me going insane.I would like to query where the dis equals someting and the state equals and the F or W or S egualsomthing. I know I am not explaining this very well and for that I am sorry.Here is as far as I can make it :($query = "SELECT * FROM tableName WHERE dis='value' and state='value'"the above is simple and works great but I get the values for S,W,F from an arrayso there might be a S and a W. So I would like to see all the jobs that have dis='value'and state='vale' and have either a S or a W='true'Maybe I'm just dreaming of the impossiable, sure hope not :(Any help would be great and thank you for you time in helping meStephen Quote Link to comment Share on other sites More sharing options...
fenway Posted May 18, 2006 Share Posted May 18, 2006 Try the following (UNTESTED):[code]SELECT * FROM tableName WHERE dis='value' and state='value' AND ( s = 'true' OR w = 'true' )[/code] Quote Link to comment Share on other sites More sharing options...
Kelset Posted May 19, 2006 Author Share Posted May 19, 2006 This seems to do the trick thank you so much. I was wondering how I was going to do this andeven tried your code but with out the brackets (doh!). Again thanks for the help, if you have time maybe explain it to me.Cheers!Stephen 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.