Hi, I need help with a complicated query.
I have 2 tables in question, members and swim_times.
The tables are joined together on members.member_id = swim_times.memberid but here's where it gets complicated:
There are the following fields in the swim_times table
eventid (int)
pool_size (int)
location (varchar)
stroke (int)
swim_time (varchar)
Now, this table is for storing swimmers swim times. The eventid is from another table and holds the swim distances like 25m, 100m, 200m etc
The pool_size is either 50 or 25
The location is a free text field that the user can input when adding the swim time
The stroke field is either 1, 2, 3, 4 or 5
The swim_time is a varchar field storing the swim times like 00:47:71 (mm:ss:ms)
I want to be able to select the swimmers best time (one result) for each of the variables like pool_size, stroke, eventid, location etc
Any ideas?
Here's the query that joins the tables
select swim_times.*, members.*
from members inner join swim_times on members.member_id = swim_times.memberid