I have a query like this
select `temp`, IfNULL(count(id),0) t
from survey
where `temp`<>'NULL' and `temp`<> '' and date(submitdate)='date'
group by `temp
with o/p
temp t
A1 1
But here is what happens on the selected date, if there are no records: I’m not getting any results. answers are like A1,A2,A3
I need o/p like this
temp t
A1 1
A2 0
A3 0
You will have to do some self-
JOINtricks to get a record for every answer:Just be sure that you have an index on
survey.temp.