I am trying to follow the example in the lecture
Is there a problem in this code here?
When you use GROUP BY clause, you should also use aggregate function. Otherwise, if you have, let say, 3 rows with the same emp_no but 3 different hire dates, which one will be chosen?
It is picking first row data for 3 rows with the same emp_no but 3 different hire dates.
We encountered a similar situation during our HAVING lecture when some individuals experienced this error. Instructor provided the following statement,
Please, execute the following command:
set @@global.sql_mode := replace(@@global.sql_mode, 'ONLY_FULL_GROUP_BY', '');
Then, you have to restart the Workbench in order to save the new settings.
Thanks for reaching out.
The first one will be chosen. But, you are right that we should use an aggregate function with the GROUP BY clause.
Please, use the code provided by Muhammad in order to resolve error message 1055.
Then, restart the Workbench in order to save the new settings.
Hope this helps.