Skip to content
Advertisement

Turn one column into multiple

Im trying to turn a single column of data,

id
1
2
3
4
5
6

into:

col1 col2 col3
1 2 3
4 5 6

I figured it would be something to do with pivots but I’m still unsure how to accomplish this.

Advertisement

Answer

We can try using a pivot query with the help of ROW_NUMBER:

Demo

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