SyntaxFix
Write A Post
Hire A Developer
Questions
country.code is not in your group by statement, and is not an aggregate (wrapped in an aggregate function).
country.code
group by
https://www.w3schools.com/sql/sql_ref_sqlserver.asp