I have a problem putting a query
into my mysql
database for attendee attendance at an event.
I have a participant table where I have participant information, and it has the attendance of those participants on days 1, 2 and 3 (the columns d1, d2, d3) where I store 0 for non-frequency and 1 for the frequency on the respective day .
Well, now I need to make an appointment where you can tell me how many days each subscribed subscriber was present: 0 (if there is no day), 1, 2 or 3 days, I'm doing this with the SUM(d1 + d2 + d3)
function.
Now I need to apply the group by
to the SUM
function to group the counts of how many participants were present in 0, 1, 2 or 3 days. But I get the error 1056 .
In what other way can I do the following query?
Query
SELECT count(*) as cont, SUM(d1 + d2 + d3) as dias
FROM guiatudoonline_cadastro.participantes
GROUP BY dias