Last answered:

20 Jun 2025

Posted on:

02 Jun 2024

4

If your getting EROOR CODE 1055: Try This Code Instead!

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

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

05 Jun 2024

0

Hi Rafi!
Thanks for reaching out.


Thanks for sharing this piece of information with the Community!



Best,
Tsvetelin

Posted on:

20 Jun 2025

0
Is the above the correct approach?

I also ran into this error, which others have run into as well it looks like. I asked ChatGPT, and it recommended the SELECT DISTINCT as the better approach, but also said we could use GROUP BY for all the rows we are selecting, as Rafi suggested above.

ChatGPT said that older versions of SQL allowed the functoinality of GROUP BY showed in the video by the instructor, but said newer versions of SQL stopped allowing this behavior by default.

Let me know what is the best industry best practice approach here please.

Thanks!

-Justin

Submit an answer