I have a table of numbers and placemarks:
seat marks 61 45 62 25 63 45 64 23 65 25 66 9 67 23
The max sign is 100. Now I want to show how many candidates fix tags at 10, 20, 30, ... 100 s
marks candidates_count 10 1 20 4 30 0 .. ..
And so on. Now i know it
SELECT seat, marks, count(marks) as counts from <table> group by marks order by counts desc;
or do it for every 10, 20 and 30 s
SELECT seat, marks from <table> where marks>10 and marks<=20 group by marks;
and get the number of rows returned in my php and return the results, but this is not very elegant. There must be a way to do this directly in MySQL and without using MySQL for loops.
source share