本文介绍了怎么解决这个请帮助.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的表格输出如下: 性别jan feb mar apr may jun jul 女11 13 13 13 13 13 13 男35 43 43 43 43 43 43 i想要我的输出 性别女性男性 jan 11 35 feb 13 43 3月13日43 .... 怎么办???请帮助我My table output is given belowGender jan feb mar apr may jun julFemale11131313131313Male35434343434343i want my output asGender female malejan 11 35feb 13 43mar 13 43....How to do ??? pls help me推荐答案ORDER BY year(Date), month(Date)GROUP BY year(Date), month(Date)SELECT *FROM ( SELECT * FROM ( SELECT 'Female' AS Gender, 11 AS Jan, 13 AS Feb, 13 AS Mar UNION SELECT 'Male' AS Gender, 35 AS Jan, 43 AS Feb, 43 AS Mar ) p UNPIVOT ( C FOR [Month] IN (Jan, Feb, Mar) ) AS unpvt ) p PIVOT ( SUM(C) FOR Gender IN (Female, Male) ) pvt 参见使用PIVOT和UNPIVOT [ ^ ] 这篇关于怎么解决这个请帮助.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-11 11:30