Posted on:

04 May 2024

2

Removing duplicate by using GROUP BY Not working

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;

I used the above SQL statement but I got a query interrupted, it doesn't show me the error details ( shows me the query completed and the result for those that display some kind of list or shows me the query interrupted if there is something wrong without any details of showing rows affected, or detail errors).

But when I remove the GROUP BY part it successfully executes the query and displays the list, I get the interrupted message when I add the GROUP BY to avoid the duplicates

Can you please help me fix the problem?

0 answers ( 0 marked as helpful)

Submit an answer