复杂sql分组查询 ( pivot)
时间:2021-07-01 10:21:17
帮助过:8人阅读
Year,Months,tDays,
[711],
[BankIn],
[iTunesHK] ,
[711]+[BankIn]+[iTunesHK] as total
FROM (
select * from #
temp)
AS t
PIVOT
(SUM(amount)
FOR [PayType] IN (
[711],
[BankIn],
[iTunesHK]))
AS t;
效果截图如下:
:
原文链接:http://www.cnblogs.com/tandaxia/p/4888623.html
复杂sql分组查询 ( pivot)
标签: