MySQL - Get id of the department? I need to find the department that has the oldest employee. My plan is to merge everything into one big table and try to sort the employees by age, then find the department that has the oldest employee, and find the manager for that department. Currently this is my query: 

SELECT * 
  FROM employees emp 
  JOIN dept_emp de       ON emp.emp_no=de.emp_no 
  JOIN departments dep   ON de.dept_no=dep.dept_no 
  JOIN dept_manager depm ON dep.dept_no=depm.dept_no 
  JOIN employees emp2    ON depm.emp_no=emp2.emp_no
-- some part of query is lost here -- 
           DESC 
 LIMIT 0, 1


;

Unfortunately, when I run that, it's saying that column 'birth_date' is ambiguous to sort - which makes sense bc I'll have 2 columns with the same date.
I've rid of the redundant second subselect so now it is the single one that fetch employee(s) having earliest date of birth (highest age), their IDs, names, IDs of their managers and names of managers.

SELECT ds.dept_no
     , ol.emp_no     AS oldest_emp_no
     , ol.birth_date AS oldest_bd
     , e1.first_name AS o_first_name
     , e1.last_name  AS o_last_name
     , dm.emp_no     AS req_manager_no
     , e2.first_name AS m_first_name
     , e2.last_name  AS m_last_name

  FROM departments  AS ds
  JOIN dept_emp     AS de ON de.dept_no = ds.dept_no
  JOIN employees    AS e1 ON e1.emp_no = de.emp_no
  JOIN ( SELECT MIN(birth_date) AS birth_date FROM employees ) 
         AS ol ON ol.birth_date = e1.birth_date
  JOIN dept_manager AS dm ON dm.dept_no = ds.dept_no
  JOIN employees    AS e2 ON e2.emp_no = dm.emp_no
;