Discussion Locked

Nested select

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

For this table:

START_TIME DATE
CHANNEL NUMBER(3)
CALL_TOT NUMBER
DUR_TOT NUMBER

... I use the query:

select to_char(start_time,'dd-MON-yy hh:mi:ss AM'), sum(call_tot)
from trasum
group by to_char(start_time,'dd-MON-yy hh:mi:ss AM');

... to Sum the call totals of all channels with respect to each hour of the day (minutes and seconds aren't counted).

Now, I want to see the Maximum call total for each day and the hour in which it falls. How mightI do that?

1 reply

by ramesh.patel

Try,
select start_time,to_char(start_time,'HH'), sum(call_tot)
from trasum
group by stat_time, to_char(start_time,'HH');

Result

01-JAN-03 8.00 13
9.00 12
10.00 9
02-JAN-03 7.00 7
8.00 22

This discussion is closed to new replies.