Skip to content
Advertisement

Show all varchar values with PIVOT

I need to show all varchar values with pivot but I’m not sure if that is possible?

I have OCCUPATIONS table:

Pivot query:

Query result:

Above query gives only 1 record in each column but I want to get all.

Advertisement

Answer

You ‘ll need an extra column, e.g. with ROW_NUMBER():

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement