Just like a cake :)
select count(field1), count(field2) from my_table
Result:
+--------+--------+ | field1 | field2 | +--------+--------+ | 5 | 3 | +--------+--------+
If the null values ββin the field2 column are equal to '' (empty rows) instead of the actual NULL , you can try the following:
select count(field1), sum(case when field2 != '' then 1 else 0 end) from my_table;
maΔek
source share