Skip to content
Advertisement

Add OR in WHERE

I have SQL query:

And I want to adjust it so it looks for p.post_status = 'publish' OR p.post_status = 't_active'.

I tried:

But it didn’t work. How do you achieve this?

This is an entry level question – SQL is not my jazz.

Advertisement

Answer

You need to use brackets to make clear what condition you’re doing the OR on:

Alternatively you can use an IN clause:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement