Question: Use subquery & CTEwhat is the year with the biggest total sales for the bikes. (original query) SELECT P.ProductID, P.Name, SUM(S.LineTotal) AS TotalSales FROM Sales.SalesOrderDetail
Use subquery & CTEwhat is the year with the biggest total sales for the bikes.
(original query)
SELECT P.ProductID, P.Name, SUM(S.LineTotal) AS TotalSales
FROM Sales.SalesOrderDetail S
JOIN Production.Product P ON S.ProductID = P.ProductID
WHERE P.ProductNumber LIKE 'BK%'
GROUP BY P.ProductID, P.Name,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
