Message-Id: <10739.126470@fatcity.com> From: sfaroult@oriole.com Date: Fri, 12 Jan 2001 09:50:01 Subject: Re: SQL Code Kevin, Partition your table, otherwise it will be the query of death. Short of that, the only thing which might be helpful is a function-based index on the suitably truncated (down to the hour) timestamp, it would help the 'GROUP BY' a lot. HTH Stephane Faroult Oriole Corporation > > > > >9-1"> >5"> >SQL Code > > > >

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 03h0>0 etc etc etc >

> >

Any ideas anybody ? >
Thanx >
Kevin N >

> > >
> >

______________________________________________l size=3D1>size=3D2>

>

Disclaimer >and >confidentiality note

>

Everything in >this e-mail and >any attachments relating to the official business of Standard Bank Invest>ment >Corporation NT face=3DArial >size=3D2>(Stanbic) is proprietary to the company. It is confidential, leg>ally >privileged and protected by law. Stanbic=3DArial >size=3D2> does not own and endorse any> other >content. Views and opinions are those of the sender unless clearly stated> as >being that of Stanbic.

>

The person add>ressed in the >e-mail is the sole authorised recipient. Please notify the sender immedia>tely if >it has unintentionally reached you and do not read, disclose or use the c>ontent >in any way.

>

>

Stanbic can not assure that the integrity of this communication has be>en >maintained nor that it is free of errors, virus, interception or >interference.

>

size=3D1>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0&nbs>p;=A0=A0_______________________________________________

<>/FONT>
> >> >-- >Please see the official ORACLE-L FAQ: http://www.orafaq.com >-- >Author: Naik, Kevin K > INET: KNaik@mail.sbic.co.za > >Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 >San Diego, California -- Public Internet access / Mailing Lists >-------------------------------------------------------------------- >To REMOVE yourself from this mailing list, send an E-Mail message >to: ListGuru@fatcity.com (note EXACT spelling of 'ListGuru') and in >the message BODY, include a line containing: UNSUB ORACLE-L >(or the name of mailing list you want to be removed from). You may >also send the HELP command for other information (like subscribing).