日期:2014-05-17 浏览次数:20420 次
select * from Tb unpiovt (sumamount for year in([QF2006],[QF2007],[QF2008],[QF2009],[QF2010],[QF2011],[QF2012]))
;with t as
(
select 2 QF2006,4 QF2007,11 QF2008,17 QF2009,27 QF2010,57 QF2011,111 QF2012
)
select * from t unpivot(sumamount for year in([QF2006],[QF2007],[QF2008],[QF2009],[QF2010],[QF2011],[QF2012])) upvt
/*
sumamount year
----------- --------------------------------------------------------
2 QF2006
4 QF2007
11 QF2008
17 QF2009
27 QF2010
57 QF2011
111 QF2012
*/