Last answered:

23 Aug 2023

Posted on:

18 Jul 2023

0

Result of query not displaying result

I ran this query


 SELECT 
        d.dept_name, e.gender, AVG(salary)
  FROM salaries s
  JOIN 
        employees e 
        ON e.emp_no = s.emp_no
  JOIN 
        dept_emp de 
        ON de.dept_no = d.dept_no
   JOIN 
        employees e
        ON e.emp_no = de.emp_no
   GROUP BY de.dept_no, e.gender
   ORDER BY de.dept_no;


this is the result i get

 

why is the result wrong?


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

23 Aug 2023

0

Hi Nike!
Thanks for reaching out.


You used an alias twice which gives error message 1066. Also, the d.dept_name column is unknown.


Hope this helps.
Best,
Tsvetelin

Submit an answer