EN
MySQL - select only rows where removal_time is NULL
1
answers
3
points
How to select only rows where removal_time is NULL with MySQL?
Doesn't work:
SELECT * FROM qa_post_comments WHERE removal_time = NULL;
It can be executed, but it doens't return any values at all - NULL or NOT NULL.
How to make it work?
1 answer
1
points
Correct SQL:
SELECT * FROM qa_post_comments WHERE removal_time IS NULL
Where we want to select rows with only NULL values:
IS NULL
And if we want to select rows with NOT NULL values:
IS NOT NULL
Eg:
SELECT * FROM qa_post_comments WHERE removal_time IS NOT NULL
Is is very common mistake and a lot of people try to use:
- = NULL
- != NULL
0 comments
Add comment