我有以下查询:
SELECT hostVersion, CONVERT(varchar, 100.0 * count(*) / tot,1) + '%' as 'Percent'
FROM hostInfo,
(SELECT COUNT(*) as tot FROM hostInfo) x
GROUP BY hostVersion, tot
并收到以下输出:
+--------------------------------+
| hostVersion | Percent |
+--------------------------------+
| 5.0.0 | 26.666666666666% |
+--------------------------------+
| 5.1.0 | 73.333333333333% |
+--------------------------------+
如何四舍五入到小数点后一位?(即 26.7% 和 73.3%)