请教大佬,下条语句的最简最佳优化:
select max(t.ida2a2)ida2a2 from table1 t,table2 A
where t.ida3=A.Ida2a2 and A.WTPARTNUMBER='WCDS000001'
and t.version=(
select VERSIONID from (
select rownum r, VERSIONID from (
select distinct t1.VERSIONID from table2 a1,table1 t1
where a1.number='WCDS000001' and t1.ida3=a1.ida2a2 order by t1.Versionid desc) where rownum < 3) e where e.r>1
)and t.IDA3VIEW=(select v.IDA2A2 from table3 v where v.name='Design')
select max(t.ida2a2)ida2a2 from table1 t,table2 A,table3 v,
(select versionid,dense() over(order by versionid) as rank from table1,table2 where table1.number='WCDS000001' and table1.ida3=table2.ida2a2) s
where s.rank=2 and t.version=s.versionid and t.ida3=A.Ida2a2 and A.WTPARTNUMBER='WCDS000001' and t.IDA3VIEW=v.IDA2A2 and v.name='Design'
EXPLAIN select * from *;
SHOW WARNINGS;
结果2,直接看编译器优化后的sql语句