select NAME
from Temp_EMP
where name not in select NAME from EMPLOYEE and deptid ='11'
我在声明中收到错误。
答案 0 :(得分:2)
您缺少子查询中的WHERE
子句:
select NAME from Temp_EMP where name not in (select NAME from EMPLOYEE WHERE deptid ='11')
答案 1 :(得分:1)
Verrigo很接近,但我认为应该更像这样:
select [NAME]
from Temp_EMP
where name not in (
select [Name]
from EMPLOYEE
) and deptid = '11'
我假设deptid
是Temp_EMP
上的一列,而deptid
实际上是一些文字字段。
约什
答案 2 :(得分:0)
尝试
select [NAME] from Temp_EMP where [name] not in (select NAME from EMPLOYEE) and deptid ='11'
或者,我认为这有点优化:
Select [Name] from temp_emp t left join
employee on e on t.[name]=e.[name]
where e.[name] is null and t.deptid = '11'