[Solved] SQL group data based on a column and pivot rows to (unknown) columns [duplicate]


A straight-up PIVOT in concert row_number() with should do the trick

Select *
 From (
        Select ID = fd_Interpretation
              ,Item = concat('Word',row_number() over (partition by fd_Interpretation order by fd_Word) )
              ,Value = fd_Word
         From  YourTable
      ) src
 Pivot ( max( Value ) for Item in ([Word1],[Word2],[Word3],[Word4],[Word5],[Word6],[Word7],[Word8]) ) pvt

2

solved SQL group data based on a column and pivot rows to (unknown) columns [duplicate]