title: pivot table and percentage comparison between columns
body: <p>I'm new to using pivot tables with sql and have been stuck on this particular issue that I'm hoping someone can help.  My script returns a list of assignments and counts the assignments for each year.  I would like to add a column that has the percentage increase or decrease change from the previous year. </p>
  
  <pre><code>SELECT *
  FROM
  (
  SELECT [year_time], [assignment_code], [assignment_desc]
  FROM raw_teacher
  ) AS source
  PIVOT
  (
      COUNT(assignment_code)
      FOR [year_time] IN ([2012], [2011], [2010], [2009], [2008])
  ) as pvt
  </code></pre>
  
  <p>Current Output:</p>
  
  <p><img src="https://i.stack.imgur.com/6Fie9.gif" alt="enter image description here"></p>
  
  <p>Desired output...
  <img src="https://i.stack.imgur.com/8mQdC.gif" alt="enter image description here"></p>