sql:
select rateRange,count(1) cnt from(
select sign(rate)*CEILING( abs(rate)/0.05)*0.05 rateRange --按0.05间隔分组
from (
SELECT newPrice/HoldPrice-1 rate from
InvestDetail d where investId=266
)x
)y
group by rateRange
order by rateRange
效果:
sql:
select rateRange,count(1) cnt from(
select sign(rate)*CEILING( abs(rate)/0.05)*0.05 rateRange --按0.05间隔分组
from (
SELECT newPrice/HoldPrice-1 rate from
InvestDetail d where investId=266
)x
)y
group by rateRange
order by rateRange
效果: