I have an activity_log table that I need to derive a basic output of how many distinct users logged in that day, and sum up them up day by day. The table logs all actions of a user and will have several entries per day for each user. Here is the table -
This is what I have so far -
select DISTINCT CAST(test.activitytime AS date) Date, username
from [dbo].[activity_log] as test
where test.activitytime between '2024-03-01' and '2024-03-08'
order by Date
Here is the output for that -
I need it to display every day once, and sum up the total of distinct users per day (does not matter if they logged in yesterday as well) just total distinct users a day. I am lost on where to go from here
ie
2024-03-01 24
2024-03-02 39
2024-03-03 26