MySQL Forums
Forum List  »  General

Re: Record Position in Ordered Selection
Posted by: Alan Little
Date: June 07, 2009 07:05AM

That looks like quite a useful reference in general. Thanks!

I don't fully understand the last query in the specified section, but this part of it seems to do what I need:

SELECT
s1.name, COUNT(s2.name) rank
FROM votes s1
JOIN votes s2 ON s1.votes < s2.votes or (s1.votes=s2.votes and s1.name = s2.name)
where s1.name = 'White';

I wonder about its efficiency, though. There are going to be thousands of listings, hopefully eventually tens or even hundreds of thousands. Am I going to be hammering the db server with this? What indices on the ranking table might help?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.