select * from a where a.s_status=1 and exists (select orderid from b where a.orderid=b.orderid)

exists执行顺序

1.首先exists 返回的是true或false

2.查询一条a的数据,会去执行exists 若返回true则存在结果集中,再执行a的下一条数据,直到a的数据执行完

3.exists 里的数据是怎么执行的呢?只要满足条件就会返回true,没必要把b表中的数据都查询一遍

 

相关文章:

  • 2021-12-04
  • 2021-09-12
  • 2022-01-06
  • 2021-08-13
  • 2021-08-30
猜你喜欢
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-04-14
  • 2021-05-28
相关资源
相似解决方案