and c_ajbh in (select distinct c_ajbh from db_zxzhld.t_zhld_zbajxx where n_dbzt = 1 and c_zblx = '1003' and c_gy = '2550' )
改写为:
and exists (select c_ajbh from db_zxzhld.t_zhld_zbajxx where n_dbzt = 1 and c_zblx = '1003' and c_gy = '2550' )

一旦满足条件则立刻返回。所以使用exists的时候子查询可以直接去掉distinct。从执行计划来看使用exists可以消除分组,提高效率。

相关文章:

  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2021-07-10
  • 2021-07-24
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2021-06-20
  • 2021-05-21
  • 2021-07-08
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案