Do you have link (foreign key) columns?


With what you have here I am not sure how you would write a join.


Also what db?  It matters :)

--
Timothy Heald
Web Portfolio Manager
Diplomatic Security
U.S. Department of State
571.345.2319

The opinions expressed here do not necessarily reflect those of the U.S. Department of State or any affiliated organization(s).  Nor have these opinions been approved or sanctioned by these organizations. This e-mail is unclassified based on the definitions in E.O. 12958.

-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 5:48 PM
To: CF-Talk
Subject: Billing System Query Help

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