开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜