group by后面是不能用case
用组合查询如:
Select t.xxxx
From
(
Select
case @SubTotal
when '核销日期' then CavProcess.CavDate
when '客户名称' then CustAbb
when '部门' then Send.depart
when '区域' then Send.Area
when '业务员' then Send.Seller
end As xxxx
From 表
) As t
Group by t.xxxx
with rollup
用组合查询如:
Select t.xxxx
From
(
Select
case @SubTotal
when '核销日期' then CavProcess.CavDate
when '客户名称' then CustAbb
when '部门' then Send.depart
when '区域' then Send.Area
when '业务员' then Send.Seller
end As xxxx
From 表
) As t
Group by t.xxxx
with rollup
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货