In my PHP application, I have a mysql article table that has the following columns:
article_id articletext category_id score
Each article has a rating, which is calculated on the basis of how popular it is and belongs to a certain category (about 10 categories are available)
My question is: how can I fulfill a query that returns the highest typed articles, alternating them by category so that, if possible, articles of the same category are returned sequentially. For example, if the highest score has a score of: 100, the returned set will be something like this:
article_id articletext category_id score
-----------------------------------------------------
142 <.....> 5 100
153 <.....> 3 97
119 <.....> 5 99
169 <.....> 2 93
121 <.....> 7 89
197 <.....> 2 92
.
.
.
() , , 10 ( 1 ), , PHP , .
? , MySQL