I have a query which goes like this.
SELECT *
FROM <database1>
WHERE (Condition1) AND (Condition2 or Condition3)
My desired result should be rows satisfying condition1 and rows satisfying either condition 2 or condition3.
But the SQL is giving me rows that are just satisfying condition1. It seems that the ‘OR’ operator between the condition2 and condition3 is doing something.
Expert opinion sought. Thanks in advance for the help.
In your comment you put:
Laid out like this you can see the structure a bit easier.
The biggest thing that is probably throwing you is the mix of
LIKE,ORandINoperators in the second part.LIKEis the only operator that can deal with wildcards,ORandINcan’t.You’d probably meant something like:
instead.