집계가 HAVING 절이나 SELECT 목록에 포함된 하위 쿼리에 없으면 ON 절에 나타날 수 없습니다. 또한 집계 중인 열은 외부 참조입니다.
Click to search this error in Google
English version
An aggregate cannot appear in an ON clause unless it is in a subquery contained in a HAVING clause or select list, and the column being aggregated is an outer reference.