Hi I have a data set that holds meteor detection data Each row is Unique Record and among other things it holds event_ID - Unique Date User_Id Im trying to write a query that will for a Given Year and Month count the events per day recorded by each contributor The following works SELECT DATE_FORMAT(date, '%d') AS DAY, COUNT(*) AS total FROM meteor_events where MONTHNAME(date) = 'August' AND Year(date) = '2018' AND meteor_events.user_ID = 13 GROUP BY DATE_FORMAT(date, '%d'); However only for a single contributor so I have to run it a number of times to get the daily totals for all the contributors - Help really appreciated Regards John B
Why not group by both the date and userid? something like this: SELECT DATE_FORMAT(date, '%d') AS DAY, COUNT(*) AS total meteor_events.user_ID FROM meteor_events where MONTHNAME(date) = 'August' AND Year(date) = '2018' AND = 13 GROUP BY meteor_events.user_ID, DATE_FORMAT(date, '%d');