Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Code
This is a multi-part message in MIME format.
------=_NextPart_000_0111_01C07C83.EFC37CE0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
SQL CodeHi Kevin,
What about something like=20
SELECT=20
COUNT(*),=20
Code,=20
TO_CHAR( Date_Stamp, 'HH24' ) Hour
FROM
Table_Name
GROUP BY
Code,=20
TO_CHAR( Date_Stamp, 'HH24' ) Hour;
It might take some processing to do the grouping by the To_Char (which give= s the hour), but it should work.
Regards
Oweson Flynn
Hi All,=20
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 c= ount 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=20 7 counts of type a, 8 of b etc, between 02h00 and 03h00 etc etc etc=20
Any ideas anybody ?=20
Thanx=20
Kevin N=20
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relating to the official bu= siness of Standard Bank Investment Corporation (Stanbic) is proprietary to = the company. It is confidential, legally privileged and protected by law. S= tanbic does not own and endorse any other content. Views and opinions are t=hose of the sender unless clearly stated as being that of Stanbic.=20
The person addressed in the e-mail is the sole authorised recipient. Plea= se notify the sender immediately if it has unintentionally reached you and = do not read, disclose or use the content in any way.
Stanbic can not assure that the integrity of this communication has been = maintained nor that it is free of errors, virus, interception or interferen= ce.
This message may contain information which is confidential and subject to l= egal privilege. If you are not the intended recipient, you may not peruse, = use, disseminate, distribute or copy this message. If you have received thi= s message in error, please notify the sender immediately by email, facsimil=e or telephone and return and/or destroy the original message.
------=_NextPart_000_0111_01C07C83.EFC37CE0
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>SQL Code</TITLE> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT size=3D2>Hi Kevin,</FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>What about something like </FONT></DIV> <DIV><FONT size=3D2>SELECT </FONT></DIV> <DIV><FONT size=3D2> COUNT(*), </FONT></DIV> <DIV><FONT size=3D2> Code, </FONT></DIV> <DIV><FONT size=3D2> TO_CHAR( Date_Stamp, 'HH24' ) Hour</FONT><= /DIV> <DIV><FONT size=3D2>FROM</FONT></DIV> <DIV><FONT size=3D2> Table_Name</FONT></DIV> <DIV><FONT size=3D2>GROUP BY</FONT></DIV> <DIV><FONT size=3D2> <DIV><FONT size=3D2> Code, </FONT></DIV> <DIV><FONT size=3D2> TO_CHAR( Date_Stamp, 'HH24' ) Hour;</FONT>= </DIV>
Flynn<BR>------------------------------------------------------------------=<BR>Certified=20
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> SQL Code</DIV> <DIV><FONT size=3D2></FONT><FONT size=3D2></FONT><BR></DIV> <P><FONT size=3D2>Hi All,</FONT> </P> <P><FONT size=3D2>I have an interesting problem, lets say I have a table =with 2=20
<BR><FONT size=3D2>Kevin N</FONT> </P> <DIV> <DIR><FONT color=3D#0000ff size=3D1> <P>______________________________________________</FONT><FONT face=3DAria=l=20
</FONT><FONT face=3DArial size=3D2>(Stanbic) is proprietary to the compan=
y. It is=20
confidential, legally privileged and protected by law. Stanbic</FONT><FON=
T=20
face=3DArial color=3D#0000ff size=3D2> </FONT><FONT face=3DArial size=3D2=
>does not own=20
and endorse any other content. Views and opinions are those of the sender=
unless clearly stated as being that of Stanbic. </FONT></FONT></P>
<P><FONT face=3DArial size=3D1><FONT face=3DArial size=3D2>The person add=
ressed in the=20
e-mail is the sole authorised recipient. Please notify the sender immedia=
tely=20
if it has unintentionally reached you and do not read, disclose or use th=
e=20
content in any way.</P>
<P align=3Djustify></P>
<P>Stanbic can not assure that the integrity of this communication has be=
en=20
maintained nor that it is free of errors, virus, interception or=20
interference.</P></FONT></FONT><FONT color=3D#0000ff></DIR>
<P><FONT=20
size=3D1> &nbs=
p; _______________________________________________</FONT></P></F=ONT></DIV></BLOCKQUOTE><CODE><FONT SIZE=3D3><BR> <BR>
********************************************************************<BR><BR>
This message may contain information which is confidential and subject to l= egal privilege. If you are not the intended recipient, you may not peruse, = use, disseminate, distribute or copy this message. If you have received thi= s message in error, please notify the sender immediately by email, facsimil=e or telephone and return and/or destroy the original message.<BR> Received on Fri Jan 12 2001 - 02:39:27 CST
![]() |
![]() |