Last answered:

04 May 2024

Posted on:

26 Jun 2023

0

Duplicate Records

Hello Martin and Team,

                                      So far everything was going on well with the lecture course until I got stuck on this query on the topic of Duplicate Records. 

The error comes when I execute the query after I added the GROUP BY clause from the previous lectures, Sir Martin started that the GROUP BY clause is normally 

used with an Aggregated Function but the query from the example doesn't seem to have the aggregated function nor where clause. Can I get assistance why my query is resulting in an error I followed that exam the same steps as Sir Martin in the lecture course.


SELECT m.dept_no, m.emp_no, d.dept_name
FROM
dept_manager_dup m
JOIN
departments_dup d
ON m.dept_no = d.dept_no
GROUP BY m.emp_no
ORDER BY dept_no;

Querry Summary:

1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'employees.m.dept_no' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by


Thanks.

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

04 May 2024

0

Hi Fredrick!

Thanks for reaching out.

Please accept my apologies for the terribly delayed response. Due to a misunderstanding on our end, although we wish we had answered a lot earlier, we are happy to reply now.

Please refer to the note on dealing with error code 1055 that you can find in the resources section of the following course lecture: 

https://learn.365datascience.com/courses/sql/join-and-where-used-together/

The idea to place the explanation there at the moment is that since programming is an area where multiple components of different type are necessary to be taken into account simultaneously, we believe there is value in not presenting all of it altogether but at the right moment throughout the course syllabus.

Hope this helps.
Best,
Martin

Submit an answer