Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this in one Query?

Status
Not open for further replies.

digimortal

Programmer
Oct 12, 2003
28
TR
I must send a dataset to a function and I can not do it in one Query.. the basic logic:

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..
 
Let me do a little change:
A material - 300Kg (300 Kg from IBI.QUANTITY)
B material - 200Kg (200 Kg from IBI.QUANTITY)
C material - 500Kg (500 Kg from IBI.QUANTITY)
is being used for 1000kg (from IBH.BaseQuan) of D product and if I sell 300 Kg of D product how much the raw materials cost?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top