-1

I am not sure how can I achieve this output. In this case, my column is one but the internal value is multiple but I need to merge all and create one unique column header. column "NAME" has multiple values

Please go through with the below problem.

https://dba.stackexchange.com/questions/261454/ignoring-null-values-in-columns-pivot-and-unpivot

Saroop Trivedi
  • 2,245
  • 6
  • 31
  • 49

1 Answers1

0

Sounds like you would follow steps like:

create new table, split name into col, row, sort by row, col to create:

row  col  data
1    A    Hello
1    B    New
2    A    World
2    B    World

then pivot on col and your are done.

row  A      B
1    Hello  New
2    World  World

does that describe your problem?

kztd
  • 3,121
  • 1
  • 20
  • 18
  • that's what he said, but where's solution? – imike Mar 07 '20 at 00:35
  • I don't see any multiple pivot and unpivot as in the title, so I don't think it this simple. Also there is not enough data to write the split code because It can't be just splitting 2 chars. Pivot code is available here https://stackoverflow.com/questions/15931607/convert-rows-to-columns-using-pivot-in-sql-server – kztd Mar 07 '20 at 00:37