Hello,

I have been straining the old noodle on this query. I have three tables 
invoice, payment, and invoice product. I need to get all invoices that 
are outstanding and past due. Simple I know but see subject. For each 
invoice that the total payment(s) amount is not equal to the total 
product(s) amount, and the invoice due date is less than equal to today 
I would like to return a set of invoice info with the due amount. This 
is on MySQL 5 running on windows.

Invoice
InvoiceID PK,   I_FirstName, I_LastName, I_Company, I_DueDate, other fields

Payment
PaymentID PK, InvoiceID FK, P_Amount, other fields

InvoiceProduct
InvoiceProductID PK, InvoiceID FK, IP_Amount, other fields

Cheers,

Scott

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2985
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6

Reply via email to