我有两张桌子:
employee(e_id,e_name,d_id),department(d_id,d_name)
我的查询是:
select d.d_name from department d where d.d_id not in (
select distinct e.d_id from employee e);
有没有其他方法可以做到这一点?。
答案 0 :(得分:1)
试试这个。
select department.* from department
left join employee
on employee.d_id = department.d_id
where employee.d_id is null