Trying to manipulate some SQL with a Pivot however what I need to pivot on is text and I cant just get it working.
customerID  appointment             appointmentNumber   treatment
9           2014-01-09 09:30:00.000 1                   Osteo F 45
9           2014-01-20 09:00:00.000 2                   Osteo F 45
9           2014-01-30 09:30:00.000 3                   Osteo F 45
9           2014-02-10 09:00:00.000 4                   Osteo F 45
What I need is to turn the column "appointmentNumber" into column headers, with the "treatment" shown below...
customerID 1 2 3 4 etc...
I have always used Pivot tables on strings for numbers (sums, counts) in the past and never on numbers for strings so I am a little lost.
I had a look at SQL Pivot with String but cant seem to apply this to my own code.
Any ideas?
 
     
     
    