Last answered:

16 Dec 2021

Posted on:

06 Nov 2021

0

I am getting error while running group by

Error Code: 1055. Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'employees.s.salary' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

SELECT      e.emp_no, e.first_name, e.last_name, s.salary FROM     employees e         RIGHT JOIN     salaries s ON e.emp_no = s.emp_no WHERE     s.salary > 145000 GROUP BY e.emp_no

1 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Dec 2021

0

Hi Prince!
Thanks for reaching out.

Please, execute the following code:
set @@global.sql_mode := replace(@@global.sql_mode, 'ONLY_FULL_GROUP_BY', '');
and then restart your Workbench. Then you can try the same query. Thank you!

Hope this helps.
Best,
Tsvetelin

Submit an answer