I have 4 tables of data. 3 tables link to the main table ITEM via itemnum
As the following depicts, I am wanting to take the three individual select statements and run them as a sum with the particular itemnum. In other words, I want it to look similar to the desired output:
ITEMNUM TOTAL
4730-00-D76-0569 15
----------------------------------------------------------
select it.itemnum, sum(inv.quantity) from item it, invtrans inv
where it.itemnum = inv.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
8
----------------------------------------------------------
select it.itemnum, sum(matu.quantity) from item it, matusetrans matu
where it.itemnum = matu.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
-10
----------------------------------------------------------
select it.itemnum, sum(matr.quantity) from item it, matrectrans matr
where it.itemnum = matr.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
17
----------------------------------------------------------
As the following depicts, I am wanting to take the three individual select statements and run them as a sum with the particular itemnum. In other words, I want it to look similar to the desired output:
ITEMNUM TOTAL
4730-00-D76-0569 15
----------------------------------------------------------
select it.itemnum, sum(inv.quantity) from item it, invtrans inv
where it.itemnum = inv.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
8
----------------------------------------------------------
select it.itemnum, sum(matu.quantity) from item it, matusetrans matu
where it.itemnum = matu.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
-10
----------------------------------------------------------
select it.itemnum, sum(matr.quantity) from item it, matrectrans matr
where it.itemnum = matr.itemnum and
it.itemnum = '4730-00-D76-0569'
group by it.itemnum
---OUTPUT
17
----------------------------------------------------------