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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to group a date field by month or day ?

Re: How to group a date field by month or day ?

From: fumi <fumi_at_tpts5.seed.net.tw>
Date: 20 Aug 1999 11:51:04 GMT
Message-ID: <7pjff8$s4j$5@news.seed.net.tw>

Jill <jc_va_at_hotmail.com> wrote in message news:7pgmi6$n57$1_at_bgtnsc02.worldnet.att.net...
> I believe you want TO_CHAR(yourdatefield,'MM'). This will return the 2 byte
> index for month.

This is not a good practice.
It loses the information of year.

> Michael Keppler wrote in message <7pgiql$npi_at_TGZ3>...
> >Hello there !
> >
> >In local SQL I used "EXTRACT(MONTH FROM datefield) AS M" to get the
> >month information out of a date field. How do I write this statement for
> >Oracle SQL to group my data by month ??
> >
> >Thanks and Good Bye, Michael.
> >--
> >Michael.Keppler_at_bigfoot.com

You can use TRUNC(datefield, 'MM'), and you can use it in a GROUP BY clause. Received on Fri Aug 20 1999 - 06:51:04 CDT

Original text of this message

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