- 论坛徽章:
- 1
|
select * from (
select a.*
from v_zyjz a
where a.dfyxx09 >= &adt_start
AND a.dfyxx09 < &adt_end
and a.sjflb01 like 'BD01%'
and ( exists
(select * from V_ZYYPMX b
where a.SZYBH01 = b.szybh01
and a.SYZXH01 = b.SYZXH01
and a.IFYXH01 = b.ifyxh01
and (( b.LX in ('A','F','G','H') and ( b.dfysj01 <&adt_start or b.dfysj01 >= &adt_end ) )
or b.LX in ('B','C','D','E')
)))
or ( ( not exists
(select * from V_ZYYPMX b
where a.SZYBH01 = b.szybh01
and a.SYZXH01 = b.SYZXH01
and a.IFYXH01 = b.ifyxh01 )
or a.szxbz01 = '0' )
) )
如何提高这个查询语句的效率,特别是如何改写NOT EXISTS |
|