MySQL Forums
Forum List  »  Newbie

Re: GROUP BY, MIN() row ordering problems!
Posted by: Gavin Lovegrove
Date: January 29, 2008 03:00AM

Hi Max,

Just for your interest ... I received this query back from another forum which also works ... I have a little trouble understanding it, but it works too!


SELECT r.resultID
, a.athleteID
, r.event
, t1.raceTime
, r.placing
, r.competition
, r.`date`
from results r
inner join athletes a
on r.athleteID = a.athleteID
inner join (
select athleteID, min(raceTime) as raceTime
from results
group by athleteID
) t1
on a.athleteID = t1.athleteID
and r.raceTime = t1.raceTime
order by raceTime

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.