i assume you're using MySQL because of the Limit clause, but what error are you 
receiving?

-----Original Message-----
From: andy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Calculating inside query?


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




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to