0

I have a table that has three columns

enter image description here

I want my result set to be like

enter image description here

Nitin Aggarwal
  • 451
  • 1
  • 7
  • 18

1 Answers1

2

You need to split the strings. Split strings the right way – or the next best way

If you are on Sql Server 2016 you can use the built in String_Split(): Splitting Strings: SQL Server 2016 To The Rescue!

SqlZim
  • 37,248
  • 6
  • 41
  • 59
  • 1
    My favorite Split string function for older versions http://www.sqlservercentral.com/articles/Tally+Table/72993/ – Pரதீப் Dec 21 '16 at 17:44
  • Ahh yes, there was a bunch of drama around Moden's split when Aaron modified it for his testing in [Split strings the right way – or the next best way](https://sqlperformance.com/2012/07/t-sql-queries/split-strings). They went so far as to shut down the comments on that post forever. I agree it is still it's a good option to have, though! – SqlZim Dec 21 '16 at 17:49