行变列,列变行

--行变列
select * from (select a,b,c from table) aa
pivot( SUM(c) FOR b IN ()) bb
order by a
--列变行
SELECT a,b,c from table
unpivot(c for b in())as aa
order by a

posted @ 2017-04-28 22:53  码着码着就习惯了  阅读(123)  评论(0)    收藏  举报