dspangenberg
New Member
- Joined
- Sep 30, 2003
- Messages
- 19
Hi all,
I'm having difficulties getting this query together.
I have a table cashflow containing several fields: ProjectID, Year, Cash_in Cash_out
Now if i have three records from One project eg:
projectID Year Cash_in CashOut
1 2000 200 300
1 2001 400 200
1 2002 400 400
2 2001 2000 3000
.. ...... ...... .......
Goal is to derive a Payback field that gives me the year in which the project was payedback. So in the case of ProjectID 1 it would be year 2001
payback field = sum (cash_in) >= sum(cash_out)
but if i use the sum function it will calculate every record of project_ID 1
it has to stop where the criteria is met.
any ideas?
any help is appreciated.
Sincerely Yours,
D. Spangenberg
I'm having difficulties getting this query together.
I have a table cashflow containing several fields: ProjectID, Year, Cash_in Cash_out
Now if i have three records from One project eg:
projectID Year Cash_in CashOut
1 2000 200 300
1 2001 400 200
1 2002 400 400
2 2001 2000 3000
.. ...... ...... .......
Goal is to derive a Payback field that gives me the year in which the project was payedback. So in the case of ProjectID 1 it would be year 2001
payback field = sum (cash_in) >= sum(cash_out)
but if i use the sum function it will calculate every record of project_ID 1
it has to stop where the criteria is met.
any ideas?
any help is appreciated.
Sincerely Yours,
D. Spangenberg