MySQL Forums
Forum List  »  Newbie

min() function multiple tables
Posted by: Carl Beebee
Date: July 31, 2007 04:26AM

I have a bit of a problem with the min function. I am trying to retrieve data from 3 tables, but only the lowest time for each person and stroke. It's working ok but it's getting the event wrong.

SELECT times.swimmer,
times.stroke,
times.distance,
events.eventname,
events.startdate,
min(times.finishtime) AS 'finishtime',
v_members.gender,
v_members.dob
FROM events,
times,
v_members
WHERE ( events.eventid = times.eventid ) and
( times.swimmer = v_members.swimmer ) and
( ( v_members.gender = 'M' ) AND
( times.stroke = 'Freestyle' ) )
GROUP BY times.swimmer,
times.stroke,
times.distance;


I suppose my question is, Does the min/max function effectivley break the WHERE clause and if so, how do I keep the relationship between a particular value and an id?

Cheers

Options: ReplyQuote


Subject
Written By
Posted
min() function multiple tables
July 31, 2007 04:26AM


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.