为什么这项工作:IN VS EXIST子查询
select custid, companyname
from sales.customers as c
where exists
(select orderid
from sales.orders as o
where c.custid = o.custid and o.orderdate = '20070212')
这并不
select custid, companyname
from sales.customers as c
where custid in
(select orderid
from sales.orders as o
where c.custid = o.custid and o.orderdate = '20070212')
什么时候应该用什么?
它是抛出一个错误还是只是没有返回? –
您需要提供示例数据和示例输出 – dbmitch