Question: Rewrite the following code so it uses a common table expression (CTE) instead of a derived table. USE AdventureWorks2012; SELECT TOP 1 SUM(TotalDue) AS Invoice_total,

Rewrite the following code so it uses a common table expression (CTE) instead of a derived table.

USE AdventureWorks2012; SELECT TOP 1 SUM(TotalDue) AS Invoice_total, VendorID FROM Purchasing.PurchaseOrderHeader GROUP BY VendorID ORDER BY Invoice_total DESC

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!