0

这就是我想要做的。根据特定标准从表中获取值的总和,并将此返回作为父选择的列,但我无法理解执行此操作的最佳(即可行)方法。我试过了

SELECT
sum(count(distinct(frsrvdate)))
FROM webusers.tblQAuditClaims qac inner join webusers.tblQAuditDetails qad using (claimId)
where qac.auditdate between '2012-01-01' and '2012-03-31'
and IsResubmitted = 0
and qad.errorflag = 0
and qac.errorflag = 0
which throws an invalid group function.   

开始认为我的方法走错了兔子洞。关于我所缺少的任何建议?

我已将其缩减为子选择部分,但仍然遇到有关如何获得计数总和的问题。

4

1 回答 1

0

在第一个查询中,您有一个额外的 )。

更正了一个——

sum(SELECT count(distinct(FrSrvDate))
     FROM webusers.tblQAuditClaims qac Left Join webusers.tblQAuditDetails qad using     (claimId)
     where qac.auditdate between '2012-01-01' and '2012-03-31'
     and IsResubmitted = 0
     and qad.errorflag = 0
     group by tracenumber)
于 2012-05-29T18:40:35.053 回答