I needed some help in making sure I am using my parenthesis correctly around AND OR statements in SQL SERVER.
SELECT DISTINCT *
FROM Table
WHERE yearmonth = 201404
AND (HasA = 1 OR HasB = 1 OR hasC = 1)
AND (HasAX = 10 OR HasBX = 10 OR HasCX = 10)
When I have my parenthesis like above my second AND line of code, it also pulls out other values like example HasCX= 23.
Ironically this line of code works well:
AND (HasA = 1 OR HasB = 1 OR hasC = 1)
How should I write my parenthesis around this ?
AND (HasAX = 10 OR HasBX = 10 OR HasCX = 10)
It should only pull out data for where the condition is met with 10.