I have a table like this:
id | module_id | answered 1 4 3 2 4 1 3 4 NULL 4 5 NULL 5 5 1
I need to calculate the number of rows for each id_ module, and the number of rows that it responds to is not NULL.
so i need a result
module_id | row_count | answered 4 3 2 5 2 1
I still have
SELECT module_id, COUNT(*) as row_count FROM table GROUP BY module_id
but I don’t know how to make a response column. Any ideas?
source share