SQL Language (MOSC)

MOSC Banner

Trying to get max count per day

edited Apr 2, 2015 5:01PM in SQL Language (MOSC) 2 commentsAnswered ✓

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

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center