tags:

views:

42

answers:

1

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_name))
+4  A: 
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
Lisa
Yes , Thanks all
Sachin Chourasiya