Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT user_name, truncate(event_time, 'YYYYMMDD HH24MI'), count(*)
- FROM job_table
- WHERE event_time > TO_DATE( some start date time)
- AND user_name IN ( list of users to query )
- GROUP BY user_name, truncate(event_time, 'YYYYMMDD HH24MI')
- Alice 2008-12-16 08:00 20
- Alice 2008-12-16 08:01 40
- SELECT
- to_char(Times.time,'hh24:mi'),
- count(*)
- FROM
- (SELECT
- time
- FROM
- dual
- WHERE
- 1=2
- MODEL
- dimension by ( 0 as key )
- measures ( sysdate -1 as time )
- rules upsert ( time[ for key from 0 to 1 increment (1/1440) ] = sysdate-1 + cv(key)) ) Times,
- job_table
- WHERE
- begintime <= Times.time
- AND
- endtime > Times.time
- AND
- user_name = 'Alice'
- GROUP BY
- Times.time
- ORDER BY
- Times.time
Add Comment
Please, Sign In to add comment