This is my table, i want to find concurrent user per hour for a given week
I am trying to calculate number of concurrent users in a time range. The input looks something like the below
Table
id user_id login_time
1 23 2016-06-08 09:10:00
2 24 2016-06-08 08:55:00
3 25 2016-06-08 09:29:00
4 26 2016-06-08 09:40:00
5 27 2016-06-08 09:08:00
6 28 2016-06-09 13:40:00
7 31 2016-06-09 14:04:00
How to get the concurrent users in time range ?
Expected Output Table
Date | Hour | User |
---|---|---|
2014-08-04 | 0 | 3 |
2014-08-04 | 1 | 2 |
2014-08-04 | 2 | 0 |
2014-08-05 | 0 | 1 |
Similar question concurrent users sql