digimortal
Programmer
I must send a dataset to a function and I can not do it in one Query.. the basic logic:
As you can see there are 3 selects,
First one selects the raw materials and their usage percentage per IBH.BaseQuan like 100kg/1000kg product
Second one selects the base percentage number like the 1000Kg above..
Third one selects the price per unit for the raw material
MatQuan is the Kg of the main product and this is basicly what I'm trying to do:
A material - 300Kg
B material - 200Kg
C material - 500Kg
is being used for 1000kg of D product and if I sell 300 Kg of D product how much the raw materials cost?
Thnx in advance..
Code:
SUM(("SELECT IBI.ComponentID, IBI.QUANTITY FROM BOMITEM IBI WHERE IBI.MATERIAL = '" & MatNum & "' "
/
"SELECT IBH.BASEQUAN FROM BOMHEAD IBH WHERE IBH.MATERIAL = '" & MatNum & "' "
*
MatQuan) * (SELECT IMF.PRICE FROM MATFMS IMF WHERE IMF.ComponentID = IBI.ComponentID ))
As you can see there are 3 selects,
First one selects the raw materials and their usage percentage per IBH.BaseQuan like 100kg/1000kg product
Second one selects the base percentage number like the 1000Kg above..
Third one selects the price per unit for the raw material
MatQuan is the Kg of the main product and this is basicly what I'm trying to do:
A material - 300Kg
B material - 200Kg
C material - 500Kg
is being used for 1000kg of D product and if I sell 300 Kg of D product how much the raw materials cost?
Thnx in advance..