Oracle query problem
Please let me know why this query is not working together. They are working separately:
( (select item_name,
sum(p_qty)
from stock
where p_date between '08/06/2010' and '08/07/2010'
group by item_name) -
( select item_name,
sum(p_r_qty)
from stock
where p_r_date between '08/06/2010' and '08/07/2010'
group by item_na开发者_如何学JAVAme))
select item_name,
sum(p_qty) ,
sum(p_r_qty)
from stock
where p_date between '08/06/2010' and '08/07/2010'
group by item_name
is this what you want ?
select item_name,
sum(p_qty)-sum(p_r_qty)
from stock
where p_date between '08/06/2010' and '08/07/2010'
group by item_name
精彩评论