當我嘗試執行此查詢:查詢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