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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!