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"> >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
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>