开发者

Oracle query problem

开发者 https://www.devze.com 2023-01-10 12:07 出处:网络
Please let me know why this query is not working together. They are working separately: ((select item_name,

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

精彩评论

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