當沒有用 EXISTS 引入子查詢時,在選擇列表中只能指定一個表達式。
比如 select * from T_Employee where FNumber not in
( select top 5* from T_Employee order by FSalary desc)
order by FSalary 在sql中執行出現錯誤
更正:select * from T_Employee where FNumber not in
(select top 5 FNumber from T_Employee order by FSalary desc)
order by FSalary
因為:如果要用in,你后面select必須能只能由一個列組成,你的select后面跟了n個列,自然報那個錯誤了
如果是多個列
select * from A where exists(
select b from tab where A.b = tab.B and A.b2 = tab.B2)