这个语句要2秒多
select t1.isncode ,
t2.pinbancode ,
t1.outercode
from tblisnstatus t1 left join tblmoserialno t2
on t1.isncode=t2.moserialno where t1.isncode='021JHRHVH4000623'同样一个语句,只是把查询的一个字段去掉,就只要0.0几秒。怎么优化上面的语句??
select t1.isncode ,
--t2.pinbancode ,
t1.outercode
from tblisnstatus t1 left join tblmoserialno t2
on t1.isncode=t2.moserialno where t1.isncode='021JHRHVH4000623'
select t1.isncode ,
t2.pinbancode ,
t1.outercode
from tblisnstatus t1 left join tblmoserialno t2
on t1.isncode=t2.moserialno where t1.isncode='021JHRHVH4000623'同样一个语句,只是把查询的一个字段去掉,就只要0.0几秒。怎么优化上面的语句??
select t1.isncode ,
--t2.pinbancode ,
t1.outercode
from tblisnstatus t1 left join tblmoserialno t2
on t1.isncode=t2.moserialno where t1.isncode='021JHRHVH4000623'
select /*+RULE*/t1.isncode ,
t2.pinbancode ,
t1.outercode
from tblisnstatus t1 left join tblmoserialno t2
on t1.isncode=t2.moserialno where t1.isncode='021JHRHVH4000623'
楼主要想从两张表中取数据的话,这样写是没有问题的,我觉得在sql语句上面没有优化的余地了。