I have a table with two columns that might be null (as well as some other columns). I would like to count how many rows that have column a, b, both and neither colu
SELECT sum(case
when a is null and b is null then 1
else 0
end) as both_null_count,
sum(case
when a is null and b is not null then 1
else 0
end) as only_a_is_null_count
FROM your_table
You can extend that for other combinations of null/not null