SELECT
COUNT(id) as t,
IF(pageId is NULL, 1, 0) as tD
FROM table_name;
| t | td |
|---|---|
| 0 | 1 |
SELECT
COUNT(id) as t,
SUM(IF(pageId is NULL, 1, 0)) as tD
FROM table_name;
| t | td |
|---|---|
| 0 | null |
Why does the second query return null if the first query returns 1?