在mysql书写分段函数的方法
mysql中的分段函数是INTERVAL()函数,sql语句如下:
SELECTINTERVAL (percent, 0, 26, 51),COUNT(1)FROMtestGROUP BYINTERVAL (percent, 0, 26, 51);
SELECT
INTERVAL (percent, 0, 26, 51),
COUNT(1)
FROM
test
GROUP BY
INTERVAL (percent, 0, 26, 51);