Reputation: 755
If I select a column from a MYSQL column, I try to check if it's different from zero (0) by the following constraint:
WHERE my_column_name <> 0
It returns false if it's zero (0) but also if it's NULL. And that's not the purpose.
How do I have to solve this problem?
Upvotes: 1
Views: 46
Reputation: 70540
NULL
- safe comparison is done with <=>
, you only need to add a NOT() as an alternative:
WHERE NOT(my_column_name <=> 0)
Upvotes: 4