I'm starting out with an Activities table that looks like the one below and I'd like to get a count for activities per user per month. The issue is right now, there are multiple rows per day for each user. I need to count only one row per day for each user.
Activities
Activity_id | user_id | activity_type | created_at
1 1 time_trial 2016-04-30
2 1 time_trial 2016-04-30
3 1 time_trial 2016-04-31
4 3 time_trial 2016-04-31
5 3 time_trial 2016-04-31
6 1 time_trial 2016-04-32
I figure the resulting table should something like
user_id | activities per month
1 3
3 1
Aucun commentaire:
Enregistrer un commentaire