查询时,加了进行计算(红色字体),怎么会报错了,不明白
SELECT M.DWDM,M.DWMC,M.JHSG,M.SJMJ,M.JSSL,M.ZZMJ, (M.JSSL/M.JHSG*100) AS JSSLPROCESS FROM (SELECT F.DWDM,F.DWMC,SUM(F.JHSG) AS JHSG,SUM(F.SJMJ) AS SJMJ,SUM(CASE WHEN P.JSSL IS NULL THEN 0.00 ELSE P.JSSL END) AS JSSL, SUM(CASE WHEN P.ZZMJ IS NULL THEN 0.00 ELSE P.ZZMJ END) AS ZZMJ,SUM(P.NUM) AS NUM FROM (SELECT S.C_DWDM AS DWDM,S.C_DWDM AS DWMC,SUM(S.P_JHSG) AS JHSG,SUM(S.P_SJMJ) SJMJ FROM YY_SG.SGJH S WHERE (C_CHECK='1' or C_CHECK='9') AND (COMM <> '2' AND COMM <> '5') GROUP BY S.C_DWDM,S.C_DWDM) F LEFT JOIN(SELECT X.PROVDWDM AS DWDM,X.PROVDWMC AS DWMC,SUM(L.ZZMJ*L.LXFH) AS ZZMJ,SUM(L.JSSL*L.LXFH) AS JSSL,COUNT(DISTINCT L.HTH) AS NUM FROM YY_SC.XJSZ X,YY_SC.XJSZLX L WHERE X.KEYNO=L.KEYNO GROUP BY X.PROVDWDM,X.PROVDWMC) P ON F.DWDM = P.DWDM GROUP BY F.DWDM,F.DWMC) M
错误:
[Error Code: -419, SQL State: 42911] DB2 SQL Error: SQLCODE=-419, SQLSTATE=42911, SQLERRMC=null, DRIVER=4.15.82. 2) [Error Code: -727, SQL State: 56098] DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-419;42911;, DRIVER=4.15.82
看了错误代码说是,十进制除法无效,难道是除数不能为字段?还是说怕除数为0
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。