For CyberKiwi,

See attached,

Ok if you run that query, you will its almost the results of yours but with some errors.

Let me explain. I have put -1 in Total (first 3 rows) because I am not sure how to get the total.

What I try to achieve, is when its Budget 2011 or Budget 2010 I need to go get the value in @table3

if its Actual 2011, I need to go inside @table4

I did case when on each P1 p2 p3 and when orderby is not 1 or 2, I did select on @table4

I dont know if its efficiant or not, maybe there is a better way..?

Last thing is for the first 3 rows (wich is Total) my total are not working properly..

for P1 P2 and P3

It seems to work for the first Row of Total... second row are all 0 but if you look at third row of total.. at P3 it writes 465 but it should be 180 (60+30+90)

This is what I need to fix if you can help me it would be appreciate..im done after.

let me know if its not clear ?

Thanks a lot kiwi.

SQLQuery4.sql
[Total] = CASE WHEN t.orderby = 1 OR t.orderby = 3

is different from all other cases that are orderby in (1,2)?