当我尝试执行此查询:查询SQL服务器 - “不包含在聚合函数或GROUP BY子句”
SELECT
EventNo, Customer.CustNo, CustName,EstCost,
SUM(EstCost) AS TotalEstCost, COUNT(*)
FROM
EventRequest
INNER JOIN
Customer ON EventRequest.CustNo = Customer.CustNo
WHERE
Status = 'Approved'
GROUP BY
Customer.CustNo;
我得到这个错误:
Column 'EventRequest.EventNo' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
的表连接在这里
感谢两个方面,它如何可以解决 –
@DraganSekuloski如果这个工作解释,请勾选它作为接受 – Matt