在 sql 查询中用小数位格式化整数

Formatting integers with a decimal place in sql query

我有 table,查询结果如下:

Lasiorhinus 100
Macrotis    100
Myrmecobius 100
Panthera    50
Sarcophilus 100

查询是这样的:

select round (count(A) / count(B), 1)

但我希望数字的格式如下:

Lasiorhinus 100.0
Macrotis    100.0
Myrmecobius 100.0
Panthera    50.0
Sarcophilus 100.0

谁能帮我用 ROUND(number, 1) 函数格式化整数 50 => 50.0?谢谢。

一个解决方案(SQL 服务器)是:

select format(round(count(A) / count(B), 1), 'N1')

参考: