Reputation: 572
How can I do this
select * from theuser where userid=1233 and active != 1
in a correct MySQL syntax?
active
can be NULL
, 0
or 1
and what I need is active
equal to NULL
or 0
, never equal to 1
.
Upvotes: 5
Views: 22450
Reputation: 902
SELECT *
FROM theuser
WHERE userid = 1233
AND (active IS NULL OR active != 1)
Upvotes: 3
Reputation: 56387
select * from theuser where userid=1233 and (active is null or active != 1)
Upvotes: 10