dominicdunmow
Technical User
I have 2 tables, with the fields below:-
Table1:
ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
-- -- -- -- -- -- -- -- --
1 4 8 6 1 2 7 5 7
2 5 9 8 4 2 5 4 4
3 4 6 8 7 4 4 2 2
Table2:
ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
-- -- -- -- -- -- -- -- --
1 2005 2005 2006 2006 2006 2007 2007 2007
2 2005 2006 2006 2006 2006 2007 2007 2007
3 2005 2005 2005 2006 2007 2007 2007 2007
table1 represents revenue payment values per quarter (not calendar quarters), Table2 represents the years that the revenue payments will be received. I need to build a query where for each ID the total revenue value per year is displayed. This has to be dynamic as the payment years can change.
Something along the lines of: ID1 Q1 and Q2 payments are in 2005 so the 2005 total will be 4 + 8. I don't know how to work this into a query though.
Thanks