clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 599317 fiddles created (18767 in the last week).

CREATE TABLE tab(i INT, status INT); INSERT INTO tab VALUES (1,1),(2,1),(3,0);
3 rows affected
 hidden batch(es)


SELECT i, COUNT(*) cnt FROM tab WHERE status = 1 GROUP BY i
i cnt
1 1
2 1
 hidden batch(es)


SELECT i, COUNT(*) cnt FROM tab WHERE status = 1 GROUP BY ALL i; -- ALL is deprecated feature
i cnt
1 1
2 1
3 0
Warning: Null value is eliminated by an aggregate or other SET operation.
 hidden batch(es)


-- workaround materializng to table SELECT i, COUNT(*) cnt INTO tab2 FROM tab WHERE status = 1 GROUP BY ALL i
Warning: Null value is eliminated by an aggregate or other SET operation. 3 rows affected
 hidden batch(es)


SELECT * FROM tab2
i cnt
1 1
2 1
3 0
 hidden batch(es)