I am trying to migrate MariaDB to MySQL database and the below SQL query is failing for me. I have tried multiple approaches but none of it works for me. The query works perfectly fine in Mariadb but fails in MySQL. Any help is appreciated
SELECT DISTINCT amc_user.* FROM amc_user
INNER JOIN users_standard ON users_standard.id = amc_user.user_id
AND (users_standard.client_id <=> 1 OR (users_standard.client_id IN (1)))
WHERE (committee_id = 11 and users_standard.active = 1 and users_standard.system = 0 and users_standard.global_spawn != 1)
AND (hidden != 1) AND (amc_user.admin = 1
OR amc_user.can_manage LIKE '%collertr%'
OR amc_user.can_access LIKE '%collertr%')
GROUP BY amc_user.user_id
ORDER BY chair DESC, users_standard.lastname ASC;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'localhost.amc_users.committee_user_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
I have also gone through this answer where the accepted answer seems incorrect to turn off ONLY_FULL_GROUP_BY. And one of the answers suggested using aggregated functions seems correct but not sure how to apply it in the above query
Mariadb version - 10.6.3-MariaDB-1:10.6.3+maria~focal
Mysql Verison - 8.0.33