I have two sql tables, purchase
and sent
, I want to know the outstanding balance of items at any date. For this I am trying to take sum(puchase.quantity) - sum(sent.quantity) where date<some date
. I can have individual queries but I dont know how to combine them.
Here are individual queries:
select item,sum(quantity) from sent where datee <'some date' group by item
select item,sum(quantity) from purchase where datee<'some date' group by item
Please tell me if there is aa better way to get the outstanding balance.
Thanks in advance.