Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

Shifting column data after a pivot

$
0
0

After creating data from a pivot I would like to shift the data to the left. 

Example:

Data after pivot

1, 2, 10, NULL, NULL, NULL, NULL, NULL, 29

2, 2, NULL, NULL, NULL, NULL, NULL, NULL, 29

3, 2, NULL, NULL, NULL, 15, NULL, NULL, 29

Data needed

1, 2, 10, 29, NULL, NULL, NULL, NULL, NULL

2, 2, 29, NULL, NULL, NULL, NULL, NULL, NULL

3, 2, 15, 29, NULL, NULL, NULL, NULL, NULL

The data are IDs in another table that will be used further down the procedure.  Maybe code needs to be changed in the PIVOT but I do not know.



Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>