-1

I have a site where I have a section for most popular lyrics. The case is that I want to Order the most pupular lyrics with respect to its ratings. And condition is, if the rating is same for two lyrics then I order by the counter which is the number of times rated.

The fields in database are rating_value and counter. For now I just using

".... ORDER BY rating_value";

Suggest me something for this kind of multiple ordering.

4

3 回答 3

1
ORDER BY rating_value DESC, rating_count DESC
于 2012-05-18T10:00:55.237 回答
0

只需在 ORDER 子句中指定更多字段:

... ORDER BY rating_value, counter
于 2012-05-18T10:01:07.487 回答
0

只需按优先级顺序将列添加到ORDER BY语句中:

 ".... ORDER BY rating_value, counter";
于 2012-05-18T10:01:45.663 回答