--几张表的数量如下:
--代码表:63条
select count(*) from etranscodeinfo; --机构表:4887条
select count(*) from bankdept;--账号表:75712 条
select count(*) from eaccount;--客户表:67363 条
select count(*) from ebankcif;--交易表:7280737 条
select count(*) from ejnl;select  t2.deptseq,count(*) as accamount from 
    (
          select  acseq,ea.deptseq from eaccount ea, 
     (
select t1.cifseq from ebankcif t1 
where t1.edition='1' and not exists(select 1 from ebankcif  where t1.cifseq=cifseq and opendate>t1.opendate) 
                             ) eb    
             where   ea.cifseq=eb.cifseq 
                                     and ea.authflag !=1  and 
          ( 
                         (ea.acstate='0' and ea.opendate <to_date(#nextEndDate#,'YYYY-MM-DD') )
                       or 
                       (ea.acstate='1' and ea.closedate>=to_date(#startDate#,'YYYY-MM-DD') and ea.closedate < to_date(#nextEndDate#,'YYYY-MM-DD'))
                        )
                    and ea.deptseq like #likeDeptSeq#||'%' 
    )  t2
    where  not exists 
    (
         select  1  from ejnl ej,etranscodeinfo et 
           where  ej.transcode=et.transcode and host='01'  and acctype='0' and ej.acseq is not null and
               ej.transdate>=to_date(#startDate#,'yyyy-mm-dd') and ej.transdate<=to_date(#endDate#,'yyyy-mm-dd')
               and ej.acseq=t2.acseq
    ) group by t2.deptseq别名t2是上半部分,查询不存在ejnl交易表中的记录。如何优化。