Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL different from

Tags:

mysql

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.

like image 660
user712027 Avatar asked Apr 25 '11 12:04

user712027


2 Answers

select * from theuser where userid=1233 and (active is null or active != 1)
like image 134
Nicola Cossu Avatar answered Nov 22 '22 05:11

Nicola Cossu


SELECT *
  FROM theuser
 WHERE userid = 1233
   AND (active IS NULL OR active != 1)
like image 40
Khalid Amin Avatar answered Nov 22 '22 06:11

Khalid Amin