I have 3 tables, Name, Supervisor and Manager. I need a query that displays a list of names and whether they are supervisors, managers, or both.
My current query accomplished 90% of the problem, returns all those that are supervisors, and checks if they are also manager or not. However, if the user is not a "Supervisor" but is a "Manager" than he is not listed on the query.
SELECT name.id,
name.email,
IF(sup.code = 1, 'Yes', 'No') as Supervisor,
IF(man.userId IS NOT NULL, 'Yes', 'No') as Manager
FROM employee name
LEFT JOIN supervisor sup ON name.id = sup.id
LEFT JOIN manager man ON name.id = man.id
WHERE sup.code = 1
Thank you