MS SQL including 'AND' & 'OR' breaks query
I'm trying to run a query that selects where db1.specific is equal to
either 'OO' or 'AA', but running my query breaks
Here's what I've tried
SELECT *lots*
FROM db1 INNER JOIN
db2 ON db1.id = db2.id
WHERE (db1.num = 2353) AND (db1.specific = 'OO') OR
(db1.specific = 'AA')
the query runs fine and returns 12 entries without the OR (db1.specific =
'AA'). But with the OR statement added it seems to run a select * or
something (query keeps going, thousands of entries)
I've tried to place the OR differently or re arrange the query but haven't
had any luck.
No comments:
Post a Comment