[RESOLVED] Complex WHERE conditions...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
NnM
Forum Newbie
Posts: 2
Joined: Sun Oct 05, 2008 12:28 pm

[RESOLVED] Complex WHERE conditions...

Post by NnM »

I want to make a query like this:

Code: Select all

 
SELECT * FROM blah WHERE cond1 = 'yeah' AND (cond2 LIKE '%search%' OR cond3 LIKE '%search%')
 
On other words, where cond1 is equal to something and either cond2 or cond3 is equal to something else.

What I tried above throws off a MySQL syntax error. Help?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Complex WHERE conditions [WHERE x=y AND (d=a OR b=c) ]

Post by onion2k »

That should work fine. Can you show us the query that's giving a syntax error?
NnM
Forum Newbie
Posts: 2
Joined: Sun Oct 05, 2008 12:28 pm

Re: Complex WHERE conditions [WHERE x=y AND (d=a OR b=c) ]

Post by NnM »

Sorry. It was just a typo. ><
Post Reply