i need to display a list of employees who do not have a designated supervisor working in the same department
Table: employee
Fields:
id INT(pk),
department_id INT,
chief_id INT,
name Varchar(100),
salary INT
Query:
SELECT One.name AS Employee,One.department_id, Two.name AS Chief, Two.department_id
FROM employee One, employee Two
WHERE (One.chief_id = Two.id AND One.department_id != Two.department_id) OR One.department_id IS NULL;