You aren't using the year anywhere in your query, so it can't break down the data by year. Try it this way SELECT Department, [2004], [2005], [2006] FROM (SELECT Department, [Year], cast(GPA as float) AS GPAFROM Student) s PIVOT ( AVG(GPA) FOR [Year] IN ([2004],[2005],[2006]) ) p ORDER BY [Department]
If you don't have a Year column in the table, just calculate it in the subquery something like thisSELECT Department, [2004], [2005], [2006] FROM (SELECT Department, year(<yourdatecolumn>) AS [Year], cast(GPA as float) AS GPAFROM Student) s PIVOT ( AVG(GPA) FOR [Year] IN ([2004],[2005],[2006]) ) p ORDER BY [Department]