Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: count by month
Did you even read Darios reply? I suggest you check that where he gives you
the solution.
-- Niall Litchfield Oracle DBA Audit Commission UK "Ben" <bthomas_at_trey-industries.com> wrote in message news:991ee5b0.0108301807.6d0454d5_at_posting.google.com...Received on Fri Aug 31 2001 - 02:49:03 CDT
> Sorry, I goofed a bit, a better example would be :
>
> > > sale saledate
> > > 12 01/16/2001
> > > 33 02/05/2001
> > > 2 03/15/2001
>
> so I can ask:
>
> select count(*)
> from table1
> where saledate >= (to_date('03-01-2001', 'MM-DD-YYYY')
> and saledate < (to_date('04-01-2001', 'MM-DD-YYYY')
> But I thought "there has to be a better way". I want to group by the
> month of the date field. So I would have the count of all the sales by
> month without having to write 12 queries. Sorry for mis posting the
> first time. I don't see how I can do this without an Oracle
> GRAB_MONTH_FROM_DATE function but I don't know much about SQL as is
> obvious.
> ben
![]() |
![]() |