Write a SELECT statement that returns a single value that re
Write a SELECT statement that returns a single value that represents the sum of the largest unpaid invoices submitted by each vendor. Use a common table expression(cte) that returns MAX(InvoiceTotal) grouped by VendorID, filtering for invoices with a balanced due.
Solution
WITH INVOICE_CTE (VendorID,maxInvoiceTotal)
AS
(
Select VendorID,MAX(InvoiceTotal) as maxInvoiceTotal
from Invoice
where due>0
)
Select MAX(maxInvoiceTotal) from
INVOICE_CTE

