how to select Count of Ranges from mysql table?

count, mysql, select

Solution

select
     count(CASE WHEN point BETWEEN 0 AND 100 THEN 1 END) as count0_100,
     count(CASE WHEN point BETWEEN 101 AND 200 THEN 1 END) as count101_200,
     count(CASE WHEN point BETWEEN 201 AND 300 THEN 1 END) as count201_300,
     ...
from
    t_poits

Problem

i have a table t_points in mySql like example in below. ``` Name Surname Point Joe Arnold 120 Michale Black 250 Masha Petrova 300 Natalie Jackson 120 John Turo 200 Bona Meseda 250 Zeyda Nura 150 Zanura Bohara 60 Shaheen Boz 360 Abbas Murat 160 Keira Black 230 Tom Robinson 480 Fred Balka 490 Semia Hudovi 90 Sona Bahari 60 ``` i want to write a query which will display the count of point ranges. Point ranges are like this: point between 0 and 100, 101 and 200, 201 and 300, 301 and 400. Result must be like below ``` 0_100 101_200 201_300 301_400 3 5 4 3 ``` i think u understand what i want to say. So which query i have to use for this result? Thanks.

Original source