Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to convert data from rows into columns

$
0
0

Hi,

I have a sql table and the data looks like this

GLYEAR	  GLMN01	GLMN02	  GLMN03	GLMN04
2007	-109712.40	6909.15	   4758.72	56.88
2007	-13411.32	19132.9   -5585.07	 4362.64

Where GLyear reprsents Year and GLMN01 is February, GLMN02 is March and so on,

Now i want my output to be something like this which i want to insert into another table

GLYear   GLMonth     GLAmount
2007	February     -109712.40
2007    March	     6909.15
2007    April         56.88

My new table has 3 columns, GLYear,GLMonth,GLAmount.

Can someone please help me with the select statement on how to do this, i can work with the inserts.

Thanks.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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