Curtis Jones
Curtis Jones

Reputation: 39

I get this error when executing The multi-part identifier "TMaterials.intMaterialID" could not be bound

I get this error when executing The multi-part identifier "TMaterials.intMaterialID" could not be bound.

Select TCustomers.intCustomerID, TJobs.intJobID, TMaterials.strDescription, TJobMaterials.intQuantity, TMaterials.monCost, (TMaterials.monCost * TJobMaterials.intQuantity) As TotalCost
From TMaterials, (
                Select Sum(TMaterials.monCost) AS TotalCost, Sum(TJobMaterials.intQuantity) As TotalQuanity
                From TJobMaterials
                INNER JOIN TMaterials ON TMaterials.intMaterialID = TJobMaterials.intMaterialID
                INNER JOIN TJobs ON TJobMaterials.intJobID = TJobs.intJobID
                WHere TJobs.intStatusID = 1
                ) sub

INNER JOIN TJobMaterials ON TMaterials.intMaterialID = TJobMaterials.intMaterialID
INNER JOIN TJobs ON TJobMaterials.intJobID = TJobs.intJobID
INNER JOIN TCustomers On TJobs.intCustomerID = TCustomers.intCustomerID
Where TJobs.intStatusID = 1
Order By TJobs.intJobID , TMaterials.intMaterialID

Upvotes: 0

Views: 29

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270713

Never use commas in the FROM clause. Always use proper, explicit, standard JOIN syntax.

It is unclear what you want to accomplish. But you can fix the syntax error by replacing the comma with CROSS JOIN.

Upvotes: 1

Related Questions