Can I select the "nth" row of a list of rows?

F

ftpgtrkrb

The application tracks athlete conditioning according to a plan.
There are some number of conditioning stations and a number of
conditioning tasks at each station. At each cycle, the athlete stops
at each station and does whatever task corresponds to that cycle.
Assuming this is cycle 5, at station 1 which has 3 associated tasks,
the athlete would do task 2 - which corresponds to "5 Mod 3". At
station 2 which has 2 tasks, the athlete would do task 1 (5 Mod 2).
I've got queries which count the number of completed cycles by athlete
and another that counts the number of tasks per station. What I'm not
clever enough to figure out is a query that will select the "x Mod
y"th activity in order to produce a training plan per athlete.



The tables I've defined thus far:

tStations
ID
1
2
3

tTasks
ID StationID
1 1
2 1
3 1
4 2
5 2
6 3

tAthletes
1
2
3

tCycles
ID Date
1 7/1/2005
2 7/8/2005

tResults
ID Athlete Cycle Task Reps
1 1 1 1 16
2 1 1 4 22
3 1 1 6 12
4 2 1 1 15
5 2 1 4 20
6 2 1 6 11
7 2 2 2 11
8 2 2 5 8
9 2 2 6 11

There'll be 45 athletes, 12 stations and a total of 36 tasks (just not
evenly divided among stations). There'll be 3 conditioning cycles per
week, but not every athlete will participate in every conditioning
cycle (despite the coach's best efforts to convince'm to). The
athlete will visit all 12 stations at each conditioning cycle (s)he
shows up for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top