Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Code

Re: SQL Code

From: alex <alex.apostolopoulos_at_mindmatics.de>
Date: Fri, 12 Jan 2001 09:54:57 +0100
Message-Id: <10739.126471@fatcity.com>


Hi Kevin,
this might be what you want

SELECT

        code_type,
        COUNT (code_type),
        TO_CHAR(dtdatetime, 'HH24')

FROM code_table
GROUP BY TO_CHAR(dtdatetime, 'HH24'), code_type;

cheers alex

> Hi All,
>
> I have an interesting problem, lets say I have a table with 2 fields, one
> with a code, and the other with a full datestamp, -+ 8 million records.
> What will the SQL code be to query this table, to show the result - the
> count of all codes that occur between every hour for the day, ie
>
> 5 counts of code type a, 6 of type b etc, between 01h00 and 02h00
> 7 counts of type a, 8 of b etc, between 02h00 and 03h00 etc etc etc
>
> Any ideas anybody ?
> Thanx
Received on Fri Jan 12 2001 - 02:54:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US