Answer:
SELECT vendor_name, invoice_number, invoice_date,
(invoice_total - payment_total - credit_total) AS balance_due
FROM vendors AS v JOIN invoices AS i
ON vendors.vendor_id = Invoices.vendor_id
WHERE invoice_total - payment_total - credit_total > 0
ORDER BY vendor_name;
Step-by-step explanation:
The query statement returns joint records of vendor name, invoice number, invoice date, and balance due from the vendor and invoice tables represented with aliases v and i respectively.
It returns an output with the WHERE clause condition to only return balance due greater than zero and the output is returned in ascending order of the vendor's names.