|
你提供的信息不准确,我只能给你大致写一下了,要注意
reg_bus_ent_id 和 s_pripid 的关系,多对多?一对多,一对一,一对多?
还有select s_pripid from f_a_dominv where flag<>'6'记录数有多少?
T.ent_state in (2,3) 有多少?
两表各自总记录数有多少?
索引是怎样的,很多问题
只有知道了这些问题后,才能正确地写出SQL,而不是单纯的“用 not exists 好不好“
select /*+ leading(t) use_hash(t2) all_rows full(T) */
t.reg_bus_ent_id,t.ent_name,t.ent_sort,t.industry_co,t.dom_district,t.reg_cap,t.est_date,t.ent_state,
t.reg_bus_ent_id,t.ent_name,t.ent_sort,t.industry_co,t.dom_district,t.reg_cap,t.est_date,t.ent_state,'3'
from reg_bus_ent t,(select /*+ FULL(f_a_dominv) */ s_pripid from f_a_dominv where flag<>'6') T2
where T.ent_state in (2,3)
and T.reg_bus_ent_id=t2.s_pripid(+)
and t2.s_pripid is null |
|