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