I have this simple MYSQL table1:
id
1
2
3
AND this table2:
id | question | answer
1 | how |
2 | are | fine
3 | you | ok
And this simple query:
SELECT table1.id,COUNT(answer NOT NULL) FROM table1 LEFT JOIN table2
ON table1.id = table2.id
I want to count non empty answer fields. I tried NOT NULL but it's not working as the answer column is NOT NULL and where is not applicable as it will lead the main query to return nothing