下面的SQL返回“无法对包含聚合或子查询的表达式执行聚合函数”,有人能帮忙吗?sum(case when Frequency = 'Monthly' then ISNULL(SUM(Amount),0.0) else 0 end) + sum(case when Frequency = 'Fortnightly' then ISNULL(SUM(Amount),
有什么方法可以优化下面的查询吗?DATE_FORMAT(a.duedate,'%d-%b-%y') AS dte, SUM(CASE WHEN (typeofnotice='ddat' AND STATUS='open') THEN 1 ELSE 0 END) AS 'DDatOpen',
SUM(CASE WHEN (typeofnotice='ddat' AND STATUS='closed') THEN 1 ELSE 0 END) AS 'DD