select page_count, truncate(page_count / 50, 0) * 50 as rounded_page_count
from a_bkinfo.books
MySQL - How can I group numbers into 50 increment
문제
I have a table that has a set of integers: i.e. 1, 2, 4, 50, 399, 600, 1245 etc. I need to rank these numbers but with 50 increment as the range. So the number will be truncated to the 0, 50, 100, 150, 200, 250, etc. The outcome will look like this:
col1 [10, 883, 709, 11, 425, 945, 825, 1000, 471, 79, 753]
col2 [0, 850, 700, 0, 400, 900, 800, 1000, 450, 50, 750]
I started with the code below but cannot get to the 50 breaks. Anyone can help? :(
select page_count, truncate(page_count, -1.5)
from a_bkinfo.books
해결책
제휴하지 않습니다 StackOverflow