Inner Join
Example 1:
SELECT TOP 5
Convert(Date,SOD.[ModifiedDate])
, PC.[Name]
, PSC.[Name]
, P.[Name]
, SUM(SOD.OrderQty) OrderQty
FROM
[Production].[Product] P
JOIN [Production].[ProductSubcategory] PSC
ON P.ProductSubcategoryID = PSC.ProductSubcategoryID
JOIN [Production].[ProductCategory] PC
ON PC.[ProductCategoryID] = PSC.ProductSubcategoryID
JOIN [Sales].[SalesOrderDetail] SOD
ON SOD.ProductID = P.ProductID
GROUP BY SOD.[ModifiedDate]
, PC.[Name]
, PSC.[Name]
, P.[Name]
ORDER BY 5 DESC
No comments:
Post a Comment