日期:2014-05-17  浏览次数:20711 次

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;