`

not exist 代替not in 特殊例子

阅读更多

 select *
   from gj_tmp_ply_08_00 tp1
  where not exists
  (select 1
           from t_ply_base b
          where t_udr_date >= to_date('20090101', 'yyyymmdd')
            and t_udr_date < to_date('200100101', 'yyyymmdd')
            and b.c_ply_no = tp1.c_ply_no);

 

以下是错误的:

 select *
   from gj_tmp_ply_08_00 tp1
  where  not exists
        (select c_orig_ply_no
           from t_ply_base
          where t_udr_date >= to_date('20090101', 'yyyymmdd')
            and t_udr_date < to_date('200100101', 'yyyymmdd'));

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics