Seaquel
SQL Server error code

SQL Server error 145

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

ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Msg145
Severity15
Group0–999

How to fix it

In other databases

Source: Database Engine events and errors