I want to find the number of data that is NULL but i do not know why this code returns an error: (Error Message said there was a problem with my WHERE)
SELECT first_review, COUNT (1) AS firstreviewisnull
FROM [table_name]
GROUP BY first_review
WHERE first_review IS NULL
I tried this code and the count returns to 0 – which I know is incorrect:
SELECT COUNT(first_review) AS firstreviewisnull
FROM [table_name]
WHERE first_review IS NULL
If possible, please help to:
- explain what i did wrong
- provide with the correct code
thank you!
>Solution :
SELECT COUNT(*) AS firstreviewisnull
FROM [table_name]
WHERE first_review IS NULL
Count() function ignores Null values (it does not count them). Use count(*) if you want to count the rows where girst_review is null.