how to select Count of Ranges from mysql table?
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?
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
- A Linux, Apache, MySQL, PHP (LAMP) stack is a combination of open source software that is typically installed together to enable a server to host dynamic […]
- MySQL is an the most popular open-source database management system, in most of hosting company its has been bundle by LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. Another alternative […]
- MySQL is the world’s most popular open-source database. Despite its powerful features, MySQL is simple to set up and easy to use. Below are some instructions […]