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

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

用到的表:

exists

exists

 

--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)

  

相关文章:

  • 2021-07-21
  • 2021-11-18
  • 2021-11-18
  • 2021-08-18
  • 2022-12-23
  • 2022-01-09
  • 2021-11-03
猜你喜欢
  • 2022-12-23
  • 2021-08-10
  • 2021-08-06
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案