怎么解决分母为0的问题??
这是我写的sql语句: select a.PERSONID, a.PERSONNAME ,(select count(BFJHB.BFKHZH) from BFJHB where BFJHB.XSRYBH = a.PERSONID and BFJHB.BFSJ between to_date('2006-11-2','yyyy-MM-dd') and to_date('2007-1-16','yyyy-MM-dd') ) b ,( case when (select count(DISTINCT TB_ASL_ACCOUNTS.CUST_ID) from TB_ASL_ACCOUNTS where TB_ASL_ACCOUNTS.SELL=a.PERSONID )=0 then 0 else ( round((select count(DISTINCT BFJHB.BFKHZH) from BFJHB where BFJHB.XSRYBH = a.PERSONID and BFJHB.BFSJ between to_date('2006-11-2','yyyy-MM-dd') and to_date('2007-1-16','yyyy-MM-dd'))/(select count(DISTINCT TB_ASL_ACCOUNTS.CUST_ID) from TB_ASL_ACCOUNTS where TB_ASL_ACCOUNTS.SELL=a.PERSONID ),2)) end )*100|| '% ' as c FROM HRM_PERSONNEL a
在oracle中测试是正确的,但是在平台中,在标准数据集里测试就报错~~~
莫非平台里不支持case when语句??
请各位高手帮帮忙啊~~~谢谢了~~~` |