解决方案 »

  1.   

    分析函数的写法吧,这个效率应该是最好的
    select a.*, 
     (select zmmc from dic_zmbm where zmbm = (
        select max(ddz)keep(dense_rank last order by bzcs) from dat_bdsj_bzxx
        where xtrq = a.xtrq and zh = a.zh and bdh = a.bdh
    )
    ) ddzm,  
     (select dqdmc from dic_dqdm where dqdm = a.dqdm) dqmc,bzcs
    from dat_bdsj_bzxx a  
     where xtrq = '2014-11-01' and zh = 'as' and bdh = 44 and czgl > 1