SELECT e.last_name,e.first_name,a.dept_name FROM employees AS e LEFT JOIN ( SELECT dp.emp_no,d.dept_name FROM departments AS d INNER JOIN dept_emp AS dp ON d.dept_no = dp.dept_no ) AS a ON e.emp_no = a.emp_no;