Showing posts with label Furniture. Show all posts
Showing posts with label Furniture. Show all posts

Wednesday, July 9, 2014

Furniture Query for Stock Sale And Remaining Products Monthly Wise


select * from total
select * from done

select x.item,x.one-y.one as one,x.two-y.two as two
from
total x
left outer join
done y
on x.id=y.id

insert into total values('Chair',6,9),('Table',7,8)

insert into done values('Chair',2,4),('Table',5,2)

delete from done where one=5




select  x.item,x.one-y.one as one,x.two-y.two as two
from
total x
left outer join
done y
on x.id=y.id

select * from total
select * from done
select distinct(x.item),SUM(x.one-y.one) as one,SUM(x.two-y.two) as two
from
total x
left outer join                                                                                            
done y
on x.id=y.id


select distinct(item) from total