SELECT total,
upto10,
emi,
repo,
arrear,
res,
[pi],
Sum(emi1) EMI,
Sum(repo1) REPO,
Sum(repo_arrear1)REPO_ARR,
Sum(res1) RESO,
Sum(pi1) [PI],
Sum(( ( Sum(emi) / 100 ) + ( Sum([repo_arrear1]) / 100 ) ) /
( ( total * 35 ) / 100 ) / 0.01)
FROM (SELECT Sum(total) total,
Sum(Cast(( ( total * 55 ) / 100 ) AS DECIMAL(8, 2))) upto10,
Sum(emi) EMI,
Sum(repo) repo,
Sum([repo arrear]) arrear,
Sum(Cast(( res ) AS DECIMAL(8, 2))) res,
Sum([pi]) [pi],
Cast(( Sum(emi) / 100 ) AS DECIMAL(2, 2)) EMI1,
Sum(repo) repo1,
Cast(( Sum([repo arrear]) / 100 ) AS DECIMAL(2, 2)) REPO_ARREAR1
,
Cast((Sum(emi)/100) AS DECIMAL(2, 2))
+ Cast((Sum([repo arrear])/100) AS DECIMAL(2, 2)) res1,
Cast(( Sum([pi]) / 100 ) AS DECIMAL(2, 2)) [PI1],
Sum(( ( Sum(emi) / 100 ) + ( Sum([repo arrear]) / 100 ) ) / (
( total * 35 ) / 100 )
/ 0.01) AS emi2
FROM [DCRA].[dbo].[dcc]
WHERE curr_date BETWEEN '2014-01-01' AND '2014-02-20'
AND circle = 'C1')AS a
GROUP BY total,
emi,
upto10,
repo,
arrear,
res,
[pi],
emi2
错误消息:无法对包含聚合或子查询的表达式执行聚合函数。
答案 0 :(得分:0)
Sum(( ( Sum(emi) / 100 ) + ( Sum([repo_arrear1]) / 100 ) ) / ( ( total * 35 ) / 100 ) / 0.01)
替换为
(( ( Sum(emi) / 100 ) + ( Sum([repo_arrear1]) / 100 ) ) / ( ( total * 35 ) / 100 ) / 0.01)