Can't have aggregate function in JOIN operation <operation>. (Error 3099)

See Also

You cannot use an aggregate function in the JOIN operation of an SQL statement.