Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Simple ( I hope) SQL needed
select to_char(order_dt,'Mon') Month, itemno, count('X') nbr_orders,
sum(quantity) Qty
from Orders
group by to_char(order_dt,'Mon'), itemno
/
Anurag
"Sanjay Raj" <rsanjaynj_at_yahoo.com> wrote in message
news:9f767483.0109171055.5a0abcc3_at_posting.google.com...
> I have table containing dates and order details
> Desc Order
> OrderID,
> ItemNo,
> Date,
> quantity,
> total
>
> The same order placed on the same day can have more than one item. I
> want a simple SQL query which will give me the number of orders of
> each item placed month wise. The date in the ORDER table is individual
> dates such as 01-JAN-01, 31-JAN-01, 05-MAR-01 etc. I want to know how
> may orders were placed by month. Say something like
>
> Month ItemNo Number of Orders Quantity
> Jan 123 10 100
> Jan 321 5 300
> Feb 123 2 80
> ....
> ...
>
> Thanks for the help
Received on Mon Sep 17 2001 - 14:23:56 CDT