Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

How to transpose each row and stack each one on top of another

$
0
0

Trying to create a query that transposes each row and stacks it on top of the others in a numeric order (by year (most recent on top) and then by quarter (1st, 2nd, 3rd, 4th). Not sure if this is possible. Have done something like this using Visual Basic but it was quite time consuming. Thinking that SQL may offer a less time consuming method.

Interface is messing up so the desired result comes first (sorry)

Text
2018 101 88 99 99 98 102 

Below is what it looks like now

Text
industry m1 m2 m3 quarter year Hotels 99 98 102 2nd quarter 2018 hotels 101 88 99 1st quarter 2018 hotels 91 92 93 4th Quarter 2017 

Viewing all articles
Browse latest Browse all 4871

Trending Articles



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