Reputation: 488
I have a table some thing like below
type
-------
|name
|name
|address
|address
|name
|null
|null
|null
|name
|rollnumber
now i want this I want all the type but expect name
WHERE `type` != 'rollnumber'
In this list, I want every thing even null but not rollnumber
I'm hoping for a better way to do that, so I could compare type
?
Thanks!
Upvotes: 1
Views: 29
Reputation: 18737
Use IS NULL
:
WHERE (`type` != 'rollnumber' OR `type` IS NULL)
If you want to exclude records with type name
:
WHERE (`type` != 'name' OR `type` IS NULL)
Upvotes: 3