Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECT help
Try this
SELECT
call_day,
.
DECODE(HH24,9,call_count),
DECODE(HH24,10,call_count),
.
.
FROM
(
SELECT count(*) call_count, TO_CHAR(date,'HH24') HH24,trunc(date) call_day
FROM calls
GROUP BY TO_CHAR(date,'HH24'),trunc(date)
)
"Rob" <rtelka_at_nospam.csc.com> wrote in message
news:b74m96$ef4$1_at_zcars0v6.ca.nortel.com...
> I'm trying to figure out how to do a SELECT, but don't know how...
>
> Ideally I'd like to get a table listing the total number of calls received
> from 8h-18h in 1 hr chunks
>
> The following:
> SELECT date, count(*) FROM calls
> WHERE date >= '01-APR-2003'
> GROUP BY date;
> works good for displaying all the calls generated each day.
>
> I can also add additional statements to nail down calls between 08:00 and
> 09:00 for example, but I guess I'd like to have one query that would
> generate something like:
> DATE DAY 8 9 10 ...
> 01-APR-2003 75 11 7 19 ...
> 02-APR-2003 66 3 5 3 ...
>
> Where column DAY lists the total for each day, column 8 will list all the
> calls received between 08:00 and 08:59, column 9 will ist all the calls
> received between 09:00 and 9:59, etc
>
> I've got troubles trying to generate multiple selects to do this.
>
> Thanks!
> Rob
>
>
Received on Thu Apr 10 2003 - 22:51:51 CDT
![]() |
![]() |