首页 > 其他 > 详细

exists

时间:2018-12-16 17:35:14      阅读:129      评论:0      收藏:0      [点我收藏+]

以前都用in很少用exists.因为不理解为什么在exists后面写select..

其实就是在任何地方都可以写子查询

用到的表:

技术分享图片

技术分享图片

 

--in
select * from r_rank where rid in(
select stu_id from r_class_info)

改为:

select * from r_rank a where exists (select 1 from r_class_info b where a.rid = b.stu_id)

  

exists

原文:https://www.cnblogs.com/dayanjing/p/10127194.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!