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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql statement help rolledQty/some Value

Status
Not open for further replies.

jcisco2

Programmer
Apr 13, 2004
102
US
I would like to roll up the qty in my Details table and / that by a number by another number stored in another table. the statement checks out when i parse it. but when i run it. i get the error Invalid column name UnitLoads. any suggestions on how to roll up a qty and / it by another value? and a side question is there a better way to write this statement?

Cheers.

Code:
select '708971' + B.ItemNumber as UPC, B.ItemNumber, D.ItemDescription, sum(cast(B.Quantity as int)) as Qty, B.OrderNumber, D.Weight,
cast((cast(B.Quantity as int) / E.PercentUnitLoadMult) as float) as UnitLoads, 
A.ShippedDate, A.ShipTo_Name, A.ShipTo_Address, A.ShipTo_Address2, A.ShipTo_City,  A.ShipTo_State, A.ShipTo_Zip, 
A.OrderNumber, A.CarrierName, C.LoadNumber, C.StopNumber
from Confirmationheader A INNER JOIN
ConfirmationDetail B 
ON A.OrderNumber = B.OrderNumber
INNER JOIN
TranWorking..tblOrderMasterfile C
ON C.OrderNumber = B.OrderNumber
INNER JOIN
QueryMaster..IM1_InventoryMasterfile D
ON D.ItemNumber = B.ItemNumber
INNER JOIN
TranMaster..tblInventoryMasterfile E
ON 
E.ItemNumber = B.ItemNumber
group by B.OrderNumber, B.ItemNumber, A.ShippedDate, A.ShipTo_Name, A.ShipTo_Address, A.ShipTo_Address2, A.ShipTo_City, A.ShipTo_State, A.ShipTo_Zip,
 A.OrderNumber, A.CarrierName, C.LoadNumber, C.StopNumber, D.ItemDescription, D.Weight, UnitLoads
 
got it
(sum(cast(B.Quantity as int)) / E.PercentUnitLoadMult) as Unit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top