sql中分母为零处理

来源:互联网 发布:淘宝店铺如何做活动 编辑:程序博客网 时间:2024/05/01 03:55
select a, b, a/b from tabName
当b=0时出错,解决方法:
select a, b, (case when b=0 then 0 else a/b end) from tabName 
原创粉丝点击