Subject | SQL Extract problem - Monthly ordered Qty |
---|---|
Author | Tanz Anthrox |
Post date | 2003-10-22T14:46:07Z |
Hi,
This SQL is working
select
extract(month from order_date) as Exmonths , Qty_ordered
from sales
And, When I try to group it. not working
select
extract(month from order_date) as Exmonths , SUM(Qty_ordered) as QTY
from sales
group by Exmonths;
------------
I solved by making view
create view V_ExtMonths (Exmonths,Qty)
as
select
extract(month from order_date) as Exmonths , Qty_ordered as QTY
from sales
and by using
select ..... from VExtMonths;
What was the reason and why do I need to create a view for it?
Regards,
[Non-text portions of this message have been removed]
This SQL is working
select
extract(month from order_date) as Exmonths , Qty_ordered
from sales
And, When I try to group it. not working
select
extract(month from order_date) as Exmonths , SUM(Qty_ordered) as QTY
from sales
group by Exmonths;
------------
I solved by making view
create view V_ExtMonths (Exmonths,Qty)
as
select
extract(month from order_date) as Exmonths , Qty_ordered as QTY
from sales
and by using
select ..... from VExtMonths;
What was the reason and why do I need to create a view for it?
Regards,
[Non-text portions of this message have been removed]