这两个SQL语句有什么区别?-- 执行速度一个是3分钟,一个是1秒钟
主要目的是字段 PAPER_MAIN_NAME.m905 和字段 PAPER_INFO.collection
满足:PAPER_MAIN_NAME.m905 = '$c' + PAPER_INFO.collection 的记录是需要的。
SQL如下:
update PAPER_MAIN_NAME set PAPER_MAIN_NAME.m211 = '$a0376'
where PAPER_MAIN_NAME.m001 in (
select PAPER_MAIN_NAME.m001 from PAPER_MAIN_NAME,PAPER_INFO
where char_length(PAPER_MAIN_NAME.m905) > 3 and
substring(PAPER_MAIN_NAME.m905,1,2)='$c' and
substring(PAPER_MAIN_NAME.m905,3,char_length(PAPER_MAIN_NAME.m905)-2)=PAPER_INFO.collection and
PAPER_INFO.kernel = '2' and
substring(PAPER_INFO.paper_class_num,1,1) ='T'
)
---------------------------------------------------------------
update PAPER_MAIN_NAME set PAPER_MAIN_NAME.m211 = '$a0376'
where PAPER_MAIN_NAME.m001 in (
select PAPER_MAIN_NAME.m001 from PAPER_MAIN_NAME,PAPER_INFO
where char_length(PAPER_MAIN_NAME.m905) > 3 and
PAPER_MAIN_NAME.m905 = '$c' + PAPER_INFO.collection and
PAPER_INFO.kernel = '2' and
substring(PAPER_INFO.paper_class_num,1,1) ='T'
)
---------------------------------------------------------------
这两个SQL语句有什么区别?
执行速度一个是3分钟
一个是1秒钟
为什么?