This seems like it should be a simple query but I think I have my eyes in backwards...

Give me all the users living in Jefferson, Bingham, Butte, Bonneville and Madison counties in the state of Idaho.

SELECT * FROM table WHERE county='Jefferson' OR county='Bingham' OR county='Butte' OR county='Bonneville' OR county='Madison' AND state='ID'

What I get is all users living in EVERY Jefferson county in the U.S!!!! My state='ID' gets ignored and none of the other counties are searched (not even in the other states!).

I'm confused... LOL

(and I know this is gonna be one of those forehead slap moments!)

SELECT * FROM table WHERE (county='Jefferson' OR county='Bingham' OR county='Butte' OR county='Bonneville' OR county='Madison') AND state='ID'

<headslap>doh!</headslap>

Damn! I shoulda thought of that! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.