I have 4 tables I'm joining in Adventureworks 2012. I cant figure out why I'm getting the 'could not be bound error'.
Msg 4104, Level 16, State 1, Line 7
The multi-part identifier "Production.ProductCategory.Name" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Production.ProductCategory.Name" could not be bound.
SELECT
COUNT(WorkOrderID) AS TotalWorkOrders,
[Production].[ProductCategory].[Name]
FROM [Production].[WorkOrder] WO
INNER JOIN [Production].[Product] P ON WO.[ProductID] = P.[ProductID]
INNER JOIN [Production].[ProductSubcategory] PS ON PS.[ProductSubcategoryID] = P.[ProductSubcategoryID]
INNER JOIN [Production].[ProductCategory] PC ON PC.[ProductCategoryID] = PS.[ProductCategoryID]
WHERE WO.[StartDate] >= '1999—03-08' AND WO.[StartDate] <= '2008-05-02'
GROUP BY [Production].[ProductCategory].[Name]