I have 2 tables, 

The first one is called emp, and has 2 columns called id and name 

The second one is called dep, and has columns called id and empid and nameOfDep

if I want to list all emp that have X dep, but don't have Y dep 

This is an example I use

```
Select e.id, e.name
from emp e
where e.id in (Select empid from deptid where deptid=X)
and e.id not in (Select empid from deptid where deptid=Y);

```

How I can make it using JOIN instead of with subqueries?