这是我的查询:
SELECT r.CALLID AS MultiRES,
c.CallDate AS CallDate,
cr.Institution AS Institution,
cr.Branch AS Branch
FROM tblResolution r
INNER JOIN tblcall c ON c.CallID=c.CallID AND c.CallDate=c.CallDate
INNER JOIN tblCaller cr ON cr.Institution = cr.Institution AND cr.Branch=cr.Branch
GROUP BY r.CALLID HAVING COUNT(*) > 1;
但是当我运行它时出现错误,我知道我需要用 group by 子句做一些事情,我只是不知道把它放在哪里。
编辑:刚刚弄清楚出了什么问题:
SELECT r.CALLID AS MultiRES,
c.CallDate AS CallDate,
cr.Institution AS Institution,
cr.Branch AS Branch
FROM tblResolution r
INNER JOIN tblcall c ON c.CallID=c.CallID AND c.CallDate=c.CallDate
INNER JOIN tblCaller cr ON cr.Institution = cr.Institution AND cr.Branch=cr.Branch
GROUP BY c.CallDate,cr.Institution,cr.Branch, r.CALLID HAVING COUNT(*) > 1;