如何重写此SQL查询以避免ORDER BY中的除零错误?
SELECT * FROM table WHERE age>'30' ORDER BY (a/b) DESC
Run Code Online (Sandbox Code Playgroud)
ORDER BY CASE WHEN b != 0 THEN a / b ELSE 0 END DESC
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
111 次 |
| 最近记录: |