Write a SELECT statement that returns four columns: VendorName From the Vendors table InvoiceNumber From the Invoices table InvoiceDate From the Invoices table Balance InvoiceTotal minus the sum of PaymentTotal and CreditTotal The result set should have one row for each invoice with a non-zero balance. Sort the result set by VendorName in ascending order.
so far I have,
SELECT VendorName, InvoiceNumber, InvoiceDate FROM Vendors, Invoices WHERE ORDER BY VendorName
I tried WHERE (InvoiceTotal - (PaymentTotal + CreditTotal) As Balance But it didn't work, any help?
SELECT VendorName, InvoiceNumber, InvoiceDate, InvoiceTotal - (PaymentTotal + CreditTotal) As Balance
FROM Vendors INNER JOIN Invoices
ON Vendors.VendorID = Invoices.VendorID
WHERE
ORDER BY VendorName