请问,将not in 改成not exists怎么改?谢谢!急!

fanrj 2003-05-15 10:46:12
将下列语句
select top 20 * from sale where salenumber not in (select top 10 salenumber from sale)
中的not in改成not exists怎么改!
谢谢!
...全文
268 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
enhydraboy 2003-05-15
  • 打赏
  • 举报
回复
agree tj_dns(愉快的登山者)
fanrj 2003-05-15
  • 打赏
  • 举报
回复
但是,好像用not in 执行速度很慢阿
firetoucher 2003-05-15
  • 打赏
  • 举报
回复
up,同意楼上,我的一样,还是不写了,以免有抄袭之嫌:)
愉快的登山者 2003-05-15
  • 打赏
  • 举报
回复
这种情况最好用not in。
not exists可以实现,但不如前者:
select top 20 * from sale as A where not exists
(select * from (select top 10 salenumber from sale) as B
where salenumber = A.salenumber)
liukanghui 2003-05-15
  • 打赏
  • 举报
回复
in 和 exists差不多的,想怎么用怎么用

34,837

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧