select if (t_ac01.aic001>0, Truncate(t_ac01.aic001/12,0)+'年'+mod(t_ac01.aic001,12) ,'0')+'月' from t_ac01
正确的应该怎么写??

解决方案 »

  1.   

    没有看懂,Truncate 是ddl,还是用文字描述清楚吧!
      

  2.   

    select (case t.aic001>0,Truncate(t_ac01.aic001/12,0)+'年'+mod(t_ac01.aic001,12) ,'0')+'月' end) from t_ac01你的truncate是干什么?
    我只按你的意思换成case语句
      

  3.   

    select case when t_ac01.aic001>0
                then trunc(t_ac01.aic001/12,0)||'年'||(t_ac01.aic001/12)||'月'
                else '0'||'月'
            end
      from t_ac01;
      

  4.   

    select case when aic001>0 then Truncate(aic001/12,0)||'年'||(aic001/12)||'月' else '0'||'月' end from t_ac01;