sql语句问题求教???selectif(t_ac01.aic001 0,Truncate(t_ac01.aic001/12,0)+ 年 +mod(t_ac01.aic001,12)
sql语句问题求教???
select if (t_ac01.aic001> 0, Truncate(t_ac01.aic001/12,0)+ '年 '+mod(t_ac01.aic001,12) , '0 ')+ '月 ' from t_ac01
正确的应该怎么写??
[解决办法]
select case when t_ac01.aic001> 0
then trunc(t_ac01.aic001/12,0)|| '年 '||(t_ac01.aic001/12)|| '月 '
else '0 '|| '月 '
end
from t_ac01;
