The following is a simplification of an invoice/payment tracking database:

Invoices
-----------------------------
InvoiceID                 INT
CustomerName          VARCHAR

InvoiceItems
-----------------------------
InvoiceItemID             INT
ItemAmount           CURRENCY

InvoicePayments
-----------------------------
InvoicePaymentID          INT
PaymentAmount        CURRENCY

I need a query to do the following: Find all invoices where the total
payments are not equal to the invoice total (line item total), and find
the difference, which is the amount due on the invoice (occasionally
overpayment).

Invoice #  Customer           Total      Paid       Due
---------- -------------  --------- --------- ---------
1245       Bob Jones         450.25    300.00    150.25
1278       Norm Stanley     2295.00    100.00   1295.00
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to