79.3k views
2 votes
SELECT vendor_name, COUNT(*) AS number_of_invoices, MAX(invoice_total - payment_total - credit_total) AS balance_due FROM vendors v JOIN invoices i ON v.vendor_id = i.vendor_id WHERE invoice_total - payment_total - credit_total > (SELECT AVG(invoice_total - payment_total - credit_total) FROM invoices) GROUP BY vendor_name ORDER BY balance_due DESC When this query is executed, the rows will be sorted by _________.

1 Answer

2 votes

Answer:

balance_due in descending sequence.

Step-by-step explanation:

When this query is executed, the rows will be sorted by balance_due in descending sequence.

User Brettb
by
6.0k points