日期:2014-05-16  浏览次数:20533 次

not in 和 not 效率区别
update sso.m_user_info ui set ui.sjfw=(
?? select oimu.organize_detail_code from
(select * from sso.m_organize_info oi inner join sso.m_organize_user mu on mu.organize_code=oi.organize_code
?? ) oimu inner join m_user_info ui1 on ui1.user_code=oimu.user_code where ui.login_name=ui1.login_name and rownum<2
)
where ui.user_code
not in(
select mu.user_code from sso.m_organize_info oi inner join sso.m_organize_user mu on oi.organize_code=mu.organize_code
??? where oi.organize_bm like '370211%' or oi.organize_bm like '37020028%' or
????????? oi.organize_bm like '37020003%' or oi.organize_name like '%法制%'
)
=======

上面的语句用了157S
而下面的语句用了仅3S


update sso.m_user_info ui set ui.sjfw=(
?? select oimu.organize_detail_code from
(select * from sso.m_organize_info oi inner join sso.m_organize_user mu on mu.organize_code=oi.organize_code
?? ) oimu inner join m_user_info ui1 on ui1.user_code=oimu.user_code where ui.login_name=ui1.login_name and rownum<2
)
where ui.user_code in(
select mu.user_code from sso.m_organize_info oi inner join sso.m_organize_user mu on oi.organize_code=mu.organize_code
??? where oi.organize_bm not like '370211%' and oi.organize_bm not like '37020028%' and
????????? oi.organize_bm not like '37020003%' and oi.organize_name not like '%法制%'
)