Report help needed

S

Steve

i have a simple DB with 3 tables: Original Contract, Change Orders, and
Invoices. Each entry requires a Job #. All jobs have only 1 original amount,
but may have many CO's and Invoices. i would like to run a report that would
take the original contract amount, apply all CO's and Invoices, and display
the current contract balance. Any help would be appreciated.
 
M

Marshall Barton

Steve said:
i have a simple DB with 3 tables: Original Contract, Change Orders, and
Invoices. Each entry requires a Job #. All jobs have only 1 original amount,
but may have many CO's and Invoices. i would like to run a report that would
take the original contract amount, apply all CO's and Invoices, and display
the current contract balance. Any help would be appreciated.


Try this sort of thing:

SELECT OC.[Job #],
OC.amount + Sum(CO.amount) - Sum(INV.amount) As Bal
FROM (Original Contract As OC LEFT JOIN Change Orders As CO
ON OC.[Job #] = CO.[Job #])
LEFT JOIN Invoices As INV
ON OC.[Job #] = INV.[Job #]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top