Skip navigation links

MySQL Forums :: Database Design & Data Modelling :: How to design


Advanced Search

Re: How to design
Posted by: Bob Field ()
Date: June 09, 2006 09:11AM

Generally to do this you want to join the table to itself using the grouping field, and add to the join condition a value comparison, then select only rows not matching any greater values:

SELECT t1.*
FROM t1 LEFT JOIN t2 ON t1.group = t2.group AND t1.score < t2.score
WHERE t2.score IS NULL;

Options: ReplyQuote


Subject Written By Posted
How to design Reto Baumann 06/09/2006 09:02AM
Re: How to design Bob Field 06/09/2006 09:11AM
Re: How to design Reto Baumann 06/09/2006 09:25AM
Re: How to design Bob Field 06/09/2006 12:54PM
Re: How to design Reto Baumann 06/11/2006 12:54AM
Re: How to design Bob Field 06/11/2006 10:02AM
Re: How to design Reto Baumann 06/11/2006 11:31AM
Re: How to design Bob Field 06/11/2006 12:24PM


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.