Ranking in MySQL
| From: | David Balatero | Date: | Sat, 10 Aug 2002 00:25:36 +0000 |
| Subject: | Ranking in MySQL | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21086@lists.php.net to get a copy of this message | ||
I have a MySQL table called images, each with a rating from 1-10. The column is a decimal(10,2). For
simplicity's sake, let's say i have the following:
CREATE TABLE images (
image_id int not null auto_increment,
image_path varchar(255) not null,
rating decimal(10,2) not null,
primary key(image_id)
);
What I'm looking to do is be able to pull from the database the ranked position each image is
in. I.e. "this image is ranked 70 out of 121"
Any suggestions on a MySQL query that could do this?
Thanks,
David Balatero
david.balatero@attbi.com