PeterWieland
Registered User.
- Local time
- Today, 09:28
- Joined
- Sep 20, 2000
- Messages
- 74
Hi,
I am writing a DB for a school sports day, and I have a query that sorts race times into 1st, 2nd 3rd etc down to 8th.
SELECT Results1.EventCode, Results1.Gender, Results1.StudentNo, Results1.Time, (Select Count(*) from Results Where [Time] < [Results1].[Time] and EventCode = [Forms]![frmResultEntry]![lstEvent] and Gender =[Forms]![frmResultEntry]![txtGender] +1 AS Place
FROM Results AS Results1
WHERE (((Results1.EventCode)=[Forms]![frmResultEntry]![lstEvent]) AND ((Results1.Gender)=[Forms]![frmResultEntry]![txtGender]))
ORDER BY Results1.Time;
This is almost perfect, except that if a competitor does not finish, a time of 0 is recorded, he is given 1st place!
I have tried every which way, but no joy. The closest I have come up with is not to include said competitor, but I really want the result shown with all 8 places.
I am sure the answer is staring me in the face, but I am now at the stage where I can't see the wood for the trees.
Pete
I am writing a DB for a school sports day, and I have a query that sorts race times into 1st, 2nd 3rd etc down to 8th.
SELECT Results1.EventCode, Results1.Gender, Results1.StudentNo, Results1.Time, (Select Count(*) from Results Where [Time] < [Results1].[Time] and EventCode = [Forms]![frmResultEntry]![lstEvent] and Gender =[Forms]![frmResultEntry]![txtGender] +1 AS Place
FROM Results AS Results1
WHERE (((Results1.EventCode)=[Forms]![frmResultEntry]![lstEvent]) AND ((Results1.Gender)=[Forms]![frmResultEntry]![txtGender]))
ORDER BY Results1.Time;
This is almost perfect, except that if a competitor does not finish, a time of 0 is recorded, he is given 1st place!
I have tried every which way, but no joy. The closest I have come up with is not to include said competitor, but I really want the result shown with all 8 places.
I am sure the answer is staring me in the face, but I am now at the stage where I can't see the wood for the trees.
Pete