Pl/sql 编程之case when的用法:(t3.LOCAL_BF_KND='111000' -- 本月基本月租费)
select sum(t1.FAV_FEE) from bi_rw.FO_A_2FAV_M_G t1, bi_rw.D_BILLFEE_KND t3 where t1.BILLFEE_KND=t3.BILLFEE_KND(+) and t3.LOCAL_BF_KND='111000' --1310557.76
如果不便于把条件t3.LOCAL_BF_KND='111000' 写在where条件中,则需要使用case when 语言来限定条件:
select sum(case when t3.LOCAL_BF_KND='111000' then t1.FAV_FEE else 0 end ) from bi_rw.FO_A_2FAV_M_G t1, bi_rw.D_BILLFEE_KND t3
where t1.BILLFEE_KND = t3.BILLFEE_KND(+) --1310557.76