Let's say that I have a database with two tables: departments (dep_id, dep_name) & employees (emp_id, emp_name, dep_id). I need to select the departments that have the employees with ids 10 AND 20. How do I do that with SQL?
Note: The following is NOT what I want:
select * from departments left join employees on employees.dep_id = departments.dep_id where employees.emp_id in (10, 20)
Because this will select the department having employees with ids 10 OR 20.
Thanks in advance.