I have a table with 2 fields
x y
---- ----
1 null
2 5
3 5
4 null
5 null
6 10
7 5
And my SQLite query is
select y,count(y)
from mytable
group by y
And the result is
null 0
5 3
10 1
It is expected to see null 3.
But the output is null 0.
what does it mean?
From Aggregate Functions in SQLite
So, the
COUNTfunction does not countNULLso useCOUNT(*)instead ofCOUNT(y).Or you can also use
COUNT(x)like this one.See this SQLFiddle