Re: MySQL 5.0: Tricky ranking requirement
Posted by: Bill Karwin
Date: June 27, 2006 01:18AM

SELECT f0.familynumber, SUM(score) AS totalscore
FROM (SELECT f1.familynumber, f1.name, f1.score, count(*)
FROM f AS f1
LEFT JOIN f AS f2 ON f1.familynumber = f2.familynumber
AND f1.score <= f2.score
GROUP BY f1.familynumber, f1.name
HAVING COUNT(*) <= 3) AS f0
GROUP BY f0.familynumber

Regards,
Bill K.



Edited 2 time(s). Last edit at 06/27/2006 01:56AM by Bill Karwin.

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL 5.0: Tricky ranking requirement
June 27, 2006 01:18AM


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.