DB2数据库 CASE WHEN的使用

select CASE WHEN T1.COMMERCIALENDDATE IS NULL THEN T1.INSURANCEMATURITYDATE WHEN YEAR(T1.COMMERCIALENDDATE) = 2014  
    THEN T1.COMMERCIALENDDATE WHEN YEAR(T1.INSURANCEMATURITYDATE) = 2014 THEN T1.INSURANCEMATURITYDATE ELSE T1.COMMERCIALENDDATE END as m, T1.INSURANCEMATURITYDATE
    ,T1.COMMERCIALENDDATE FROM RT_INSURANCEBUY T1

 

你可能感兴趣的:(case when)