分子为0,应该没有问题.你应该判断分母!=0的情况SELECT 姓名,语文,数学,总分,
case when 总分=0 then 0 else 语文/总分 end AS 语文比重,
case when 总分=0 then 0 else 数学/总分 end AS 数学比重
FROM 学生成绩表
case when 总分=0 then 0 else 语文/总分 end AS 语文比重,
case when 总分=0 then 0 else 数学/总分 end AS 数学比重
FROM 学生成绩表
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货