开发者

SQL zero division

开发者 https://www.devze.com 2023-03-26 21:51 出处:网络
How can I rewrite this SQL query to avoid d开发者_开发知识库ivision by zero errors in the ORDER BY?

How can I rewrite this SQL query to avoid d开发者_开发知识库ivision by zero errors in the ORDER BY?

SELECT * FROM table WHERE age>'30' ORDER BY (a/b) DESC


ORDER BY CASE WHEN b != 0 THEN a / b ELSE 0 END DESC
0

精彩评论

暂无评论...
验证码 换一张
取 消