I\'m looking for a query which will return me an extra column at the end of my current query which is the count of all columns within the return set which contain a null column.
As in a similar post, SQL is not very suited to work across different columns within a row, but muach better on working across rows.
I'd suggest to turn the table into 'individual' facts about a row, e.g.
select , col1 as value From aTable
UNION
select , col2 as value From aTable
UNION
... and so on for the other columns to be summed.
This can be turned into a view i.e.
create view aView as (select as above).
Then the correct answer is just
select key, count(*)
from aView
where value is null
Group By key