Seaquel
SQL Server error code

SQL Server error 8125

SQL Server raises error 8125 at severity 16, which marks a problem with the query or data that you can correct.

An aggregated expression containing an outer reference must be contained in either the select list, or a HAVING clause subquery in the query whose FROM clause contains the table with the column being aggregated.
Msg8125
Severity16
Group8000–8999

Source: Database Engine events and errors