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

Home -> Community -> Usenet -> c.d.o.misc -> Re: group by for column of type date

Re: group by for column of type date

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 20 Nov 2002 09:40:25 -0800
Message-ID: <336da121.0211200940.690067b@posting.google.com>


Matthias Rogel <rogel_at_web.de> wrote in message news:<arfjs7$hcavn$1_at_ID-86071.news.dfncis.de>...
> SELECT TO_CHAR(crea_date, 'YYYY-MM-DD') crea_date,
> COUNT(*) crea_date_cnt
> FROM cct_access
> WHERE crea_date >= TO_DATE('2002-11-06 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
> GROUP TO_CHAR(crea_date, 'YYYY-MM-DD');
>

Better:

GROUP BY TRUNC(crea_date)

> ?
>
>
> Michael Howitz wrote:
> > hello newsgroup!
> >
> > i have a table where i also stored the creation date of the row.
> > now i want to select how many rows where created on each day.
> >
> > my current select string is:
> >
> > SELECT TO_CHAR(crea_date, 'YYYY-MM-DD') crea_date,
> > COUNT(crea_date) crea_date_cnt
> > FROM cct_access
> > WHERE crea_date >= TO_DATE('2002-11-06 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
> > GROUP BY crea_date;
> >
> > but it only groups the rows which are created at the same second but i
> > want to group by the same day.
> >
> > the column crea_date is of type date and a have oracle 8.1.5, 8.1.7, 9.0
> > and 9.2 (the solution should run on each of this versions).
> >
> > thanks in advance,
Received on Wed Nov 20 2002 - 11:40:25 CST

Original text of this message

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