Calculating inside query?
| From: | andy | Date: | Wed, 10 Jul 2002 16:34:10 +0000 |
| Subject: | Calculating inside query? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20460@lists.php.net to get a copy of this message | ||
Hi there,
I would like to find out the top 10 of some ratings. There are 2 columns.
One for the rating and one for the amount of ratings.
To find out the top 10 I would have to divide those 2 values and sort it.
Somehow this does not work. I do not have a clue why. Maybe someone of you
guys do see the error:
Mysql:
SELECT
ID,
rating_total / ratings_amount AS top10
FROM rating
ORDER BY top10 desc
LIMIT 10
Thanx for any help,
Andy
query