AND
has higher precedence than OR
, so your existing expression is currently evaluated as:
WHERE
(t.type = 'single' AND t.status='1' AND t.org = 'RA') OR t.org = 'DUAL'
To force alternative logic, one needs to include explicit parentheses:
WHERE
t.type = 'single' AND t.status='1' AND (t.org = 'RA' OR t.org = 'DUAL')
However, in this case, one can use MySQL's IN()
operator instead of OR
:
WHERE
t.type = 'single' AND t.status='1' AND t.org IN ('RA','DUAL')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…