The SQL SELECT statement contains aggregate and non-aggregate select list items, and this requires a GROUP BY expression.
Edit the statement and use GROUP BY or change the statement's structure.