Page 1 of 1

[mysql] "order by" question [solved]

Posted: Sun Feb 15, 2004 8:01 am
by bytte
Hi,
I have a database table called music.
It stores information about mp3's that users can post.
Users can also rate the mp3's.

Therefor i have a column called score and a column called score_number.

Score is the sum of all points an mp3 gets when someone rates it.
score_number is the amount of people that rated the mp3.

to know the rating of a song i divide score by score_number.


Now I want users to be able to select the songs by rating. So the top rated songs should appear first. How can I do this with an ORDER BY statement? I can't do this can i?:

"SELECT * FROM music ORDER BY score/score_number"

Posted: Sun Feb 15, 2004 9:04 am
by bytte
i just found out that i actually can do this query.
haha. i didn't know. sorry.