Oracle 查询很久没有结果

where条件中不添加and a.qxjg like 'sx%' 则可执行;
添加上则会执行很久没有结果,请教原因!谢谢!

where a.blfsdm in ('010000', '020000')
and b.djjglb = '0000'
and b.QGCCBZ = '1'
and b.xfmddm in ('02', '03')

       and a.xfjbh not in
           (select distinct xfjbh from THXFJXX where a.blsj = blsj)
       and a.xfjbh not in
           (select distinct (m.xfjbh) as m_xfjbh

              from (select distinct t.xfjbh
                      from blfsxx t
                      left join xfjxx b
                        on t.xfjid = b.recordid
                     where (t.bljgdm = '-' or
                           substr(t.bljgdm, 1, 6) = 'BW0061')
                       and b.djjglb = '0000'
                       and (t.blfsdm = '010000' or t.blfsdm = '020000')
                       and b.QGCCBZ = '1'
                       and b.xfmddm in ('02', '03')
                       and t.xfjbh not in
                           (select distinct xfjbh
                              from THXFJXX
                             where t.blsj = blsj)) m
             inner join (select distinct t.xfjbh
                          from blfsxx t

                         where substr(t.bljgdm, 1, 2) = '61'
                           and t.blfsdm like '04%') n
                on m.xfjbh = n.xfjbh)
       and to_char((b.djsj + 30), 'yyyymmdd') <=
           (select to_char(sysdate, 'yyyymmdd') from dual)
     and a.qxjg like 'sx%' 
   --  order by to_char((b.djsj + 30), 'yyyymm') || '01' desc
    /* where q.n_xfjbh is not null
    and q.n_bljgdm is not null
    and q.n_blsj is not null*/
    ) Y

group by Y.timekey, Y.xzqh, Y.djjglb, Y.nrfldm, Y.xfxs

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!