I need help with this please
Write a SELECT query that returns the vendorName and the SUM of the balanceDue (as we defined it above) as sumBalanceDue for all invoices with a past due balance (DATEDIFF < 0 and balanceDue > 0) GROUP BY vendorName (of course) and sort by sumBalanceDue with the greatest first.
balance due for an invoice is the invoiceTotal - paymentTotal - creditTotal.
This is what I did
ELECT VendorName, SUM(invoiceTotal - paymentTotal - creditTotal) AS BalanceDue
FROM Invoices, Vendors
WHERE InvoiceDueDate <= DATEDIFF
AND balanceDue > 0
GROUP BY VendorName
ORDER BY SUM InvoiceTotal - paymentTotal - creditTotal AS BalanceDue