user712027
user712027

Reputation: 572

MySQL different from

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

Answers (2)

Khalid Amin
Khalid Amin

Reputation: 902

SELECT *
  FROM theuser
 WHERE userid = 1233
   AND (active IS NULL OR active != 1)

Upvotes: 3

Nicola Cossu
Nicola Cossu

Reputation: 56387

select * from theuser where userid=1233 and (active is null or active != 1)

Upvotes: 10

Related Questions