• I found the code here but no test data only screen shot.

    http://www.codeproject.com/Tips/500811/Simple-Way-To-Use-Pivot-In-SQL-Query