Question: Rewrite the following query so it uses a common table expression (CTE) instead of derived table. USE AP; SELECT SUM(InvoiceMax) AS SumOfMaximums FROM (SELECT VendorID,

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

USE AP; SELECT SUM(InvoiceMax) AS SumOfMaximums FROM (SELECT VendorID, MAX(InvoiceTotal) AS InvoiceMax FROM Invoices WHERE InvoiceTotal - CreditTotal - PaymentTotal > 0 GROUP BY VendorID) AS MaxInvoice;

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!