select NAME
from Temp_EMP
where name not in select NAME from EMPLOYEE and deptid ='11'
我在聲明中收到錯誤。SQL QUERY ISSUE(NOT IN)
select NAME
from Temp_EMP
where name not in select NAME from EMPLOYEE and deptid ='11'
我在聲明中收到錯誤。SQL QUERY ISSUE(NOT IN)
你缺少子查詢的WHERE
條款:
select NAME from Temp_EMP where name not in (select NAME from EMPLOYEE WHERE deptid ='11')
thanx Ken keenan – happysmile 2011-02-28 15:03:50
嘗試
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'
如果不符合邏輯: 從Temp_EMP中選擇[名稱]不在(從EMPLOYEE選擇NAME)和deptid = '11' – 2011-02-28 14:07:19
+ 1 Nick的[NAME]。非常感謝。 – 2011-02-28 14:15:07
Verrigo接近,但我認爲它應該更像這樣:
select [NAME]
from Temp_EMP
where name not in (
select [Name]
from EMPLOYEE
) and deptid = '11'
我假設deptid
是Temp_EMP
列,而deptid
其實一些文本字段。
Josh
你得到的錯誤是什麼? – 2011-02-28 14:04:43
如果您發佈代碼,XML或數據樣本,請**在文本編輯器中突出顯示這些行,然後單擊編輯器工具欄上的「代碼樣本」按鈕(「{}」)以精確地格式化和語法突出顯示它! – 2011-02-28 14:09:15
**停止在美國**(我們不是那些造成你的麻煩......),並給我們**確切的錯誤信息**你越來越! – 2011-02-28 14:09:52