I have a dataset as follows:

____________________________________
comp_id    fk_id   year   compliance
1           185    2003    97
2           185    2004    100
3           185    2005    100
4           186    2003    96
5           186    2004    97
6           186    2005    98
7           187    2003    56
8           187    2004    78
9           187    2005    98
-------------------------------------

I want to get it into the following format temporarily to show in a report:

______________________________________________________________
fk_id   current_year(2005)   current-1(2004)   current-2(2003)
185     100                  100               97
186     98                    97               96
187     98                    78               56
-----------------------------------------------------------------

Can I do this in a VIEW with a SELF-JOIN or oth SQL command or do I need to run it through some code in a WHILE loop?

james

Reply via email to