聚合函数对NULL统计
Table
ID Amount Number
1 28.26 NULL
2 NULL NULL
3 NULL NULL
SQL
SELECT SUM(Amount),SUM(Number),COUNT(Amount),COUNT(Number),COUNT(1)
FROM Test
SELECT SUM(Amount),SUM(Number),COUNT(Amount),COUNT(Number),COUNT(1)
FROM Test
WHERE ID = -1
Data
28.26 NULL 1 0 3
NULL NULL 0 0 0