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
Get step-by-step solutions from verified subject matter experts
