Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to group a date field by month or day ?
On Thu, 19 Aug 1999 11:34:47 +0200, "Michael Keppler"
<Michael.Keppler_at_bigfoot.com> wrote:
>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 ??
SELECT TO_CHAR(datefield,'MM') from yourtable;
DD gets you the day, YYYY the year, MON the month in JAN, FEB, MAR form, and so forth. HH, MI, SS get you hours, minutes and seconds.
Jonathan