I'm struggling to get a SQL statement to run.
I need to have an and
/ or
statement which gives me:
Where Condition 1 is true
OR
Where both Condition 2 AND Condition 3 are true. (not only one of them)
Appreciate some ideas :)
I'm struggling to get a SQL statement to run.
I need to have an and
/ or
statement which gives me:
Where Condition 1 is true
OR
Where both Condition 2 AND Condition 3 are true. (not only one of them)
Appreciate some ideas :)
You can split them with parenthesis, you also only need to define 'WHERE' once. Example:
WHERE
{condition_1} or ({condition_2} and {condition_3})
Edit: You don't technically require parenthesis due to AND having a higher precedence than OR, but it makes it much easier to read and see at a glance exactly what you're trying to do.