Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL count by time intervals
Oops use this
bre on shift skip 2 on call_type skip 1
compute sum of cc on shift
select case
when date_time_rec between to_date('11-06-2005 07:00','MM-DD-YYYY HH24:MI') and to_date('11-06-2005 14:59','MM-DD-YYYY HH24:MI') then 'FirstShift' when date_time_rec between to_date('11-06-2005 15:00','MM-DD-YYYY HH24:MI') and to_date('11-06-2005 22:59','MM-DD-YYYY HH24:MI') then 'SecondShift' when date_time_rec between to_date('11-06-2005 23:00','MM-DD-YYYY HH24:MI') and to_date('11-07-2005 06:59','MM-DD-YYYY HH24:MI') then 'ThirdShift' end as Shift, call_type, count(*) cc
![]() |
![]() |