Jump to content

Archived

This topic is now archived and is closed to further replies.

Kelset

Query Help

Recommended Posts

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 egual
somthing. 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 array
so 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 me

Stephen

Share this post


Link to post
Share on other sites
Try the following (UNTESTED):

[code]SELECT * FROM tableName WHERE dis='value' and state='value' AND ( s = 'true' OR w = 'true' )[/code]

Share this post


Link to post
Share on other sites
This seems to do the trick thank you so much. I was wondering how I was going to do this and
even 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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.