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 query

RE: sql query

From: Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>
Date: Mon, 07 May 2001 11:59:09 -0700
Message-ID: <F001.002FB3BB.20010507120233@fatcity.com>

see answer below

> -----Original Message-----
> From: Ravindra Basavaraja [mailto:ravindra_at_sentica.com]
>
> I want to get count of records that are generated every hour.(group by
> hour).
> Since the date field will have timestamp varying every second
> how do I group
> a set of records for every hour.
>
> Like
>
> count(*)      Time(in hour)
> -------       -------------
> 10            00-01
> 20            01-02
> 30            02-03 like wise for every hour.
>
> Can i do this by using the GROUP BY clause.If so pls help me.

Read the manual on the TRUNC function as it applies to date. Your group by would be "group by trunc (date_field, 'HH24')" Received on Mon May 07 2001 - 13:59:09 CDT

Original text of this message

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