Trying to get max count per day
I have a table that stores user session information. Data is updated every 5 minutes throughout the day. I can get the number of sessions for each time period for a specific date like this:
select to_char(datetime,'YYYYMMDD HH24:MI'), count(userid)
from sessions
where to_char(datetime,'YYYYMMDD') = '20150330'
group by datetime
order by datetime
This gives me results like this:
Date/Time # of concurrent sessions
20150330 11:58 2
20150330 12:03 2
20150330 12:08 3
20150330 12:13 3
20150330 12:18 2
20150330 12:23 2
20150330 12:28 2
20150330 12:33 3
20150330 12:38 3
20150330 12:43 2
I would like to get the maximum sessions for any given time period for every day. For example, I would like to get results like this:
Date Maximum # of concurrent sessions