没啥好办法,自定义分组吧。如果是mysql的话试一下这个,把表a换成你的sql查询就行了。
SELECT FLOOR((value - 585) / 1) * 1 + 585 AS range_start,
FLOOR((value - 585) / 1) * 1 + 586 AS range_end,
COUNT(*) AS count
FROM (SELECT ROUND(RAND() * (605.0 - 585.0) + 585.0, 1) AS value
FROM (SELECT 1 AS number
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
UNION ALL SELECT 6
UNION ALL SELECT 7
UNION ALL SELECT 8
UNION ALL SELECT 9
UNION ALL SELECT 10
UNION ALL SELECT 11
UNION ALL SELECT 12
UNION ALL SELECT 13
UNION ALL SELECT 14
UNION ALL SELECT 15
UNION ALL SELECT 16
UNION ALL SELECT 17
UNION ALL SELECT 18
UNION ALL SELECT 19
UNION ALL SELECT 20
) AS numbers) a
WHERE value BETWEEN 585 AND 605
GROUP BY FLOOR((value - 585) / 1)