Padma-1078840
SSC Enthusiast
Points: 161
More actions
June 26, 2009 at 11:05 am
#95433
I have a table described below
Id personId YearJanAmt febAmtmarchamt
1 300 1999$100$200$300
2 444 2000$ 125$100$250
3 111 2008$105$205$106
I need to do a partial transpose as shown below:
IDpersonId yearAmt
13001999$100
23001999$200
33001999$300
44442000$ 125
54442000$100
64442000$250
71112008$105
81112008$205
91112008$106
Any help will be appreciated.
stopitallready
SSC Eights!
Points: 800
June 26, 2009 at 12:19 pm
#1016227
How about:
SELECT ID, PersonID, YEAR, Amount
FROM YourTable
UNPIVOT
(Amount FOR MONTHS IN
(JanAmt, FebAmt, MarAmt)) AS U
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply