标签: sql
如何重写此SQL查询以避免ORDER BY中的除零错误?
SELECT * FROM table WHERE age>'30' ORDER BY (a/b) DESC
答案 0 :(得分:9)
ORDER BY CASE WHEN b != 0 THEN a / b ELSE 0 END DESC