I have a database recording the participation of people on walks. To meet normalization rules there are three tables - People, Walks and Walk_participat ion_history. The Walks table gives extra information about the walk such as the date and venue, and the walk_participat ion_history (WPH) table gives details of each person's involvement such as his position on the walk, photo number etc. Each person may participate on one or several walks, so there will be a WPH record for each time he goes on a walk.
I need to extract details of a person's involvement in the most recent walk he has attended. So I have made a query with the required fields from all three tables, and tried to use GroupOn People.Person_I D and Max(Walks.Date) to get each person's most recent walk. The problem is how to get the other fields into the output. Once I click on the Totals button for the query it seems to insist that every field in the query has some sort of aggregation applied, whereas I want to carry the walk number, position, photo number etc from the most recent record for each person into the output.
Looking at posts on the internet I gather that the answer is to use a subquery, but because three tables are involved I can't quite get my head around how to do it. Any help would be much appreciated.
PEOPLE......... ........WPH.... ............... .WALKS
...Person_ID... ..........Perso n_ID........... ...Walk_no
...Age......... .......... ..Walk_number.. .......Date
...Suburb_ID... ..........Posit ion............ ...Venue
.....etc....... ..............e tc............. ............etc
I need to extract details of a person's involvement in the most recent walk he has attended. So I have made a query with the required fields from all three tables, and tried to use GroupOn People.Person_I D and Max(Walks.Date) to get each person's most recent walk. The problem is how to get the other fields into the output. Once I click on the Totals button for the query it seems to insist that every field in the query has some sort of aggregation applied, whereas I want to carry the walk number, position, photo number etc from the most recent record for each person into the output.
Looking at posts on the internet I gather that the answer is to use a subquery, but because three tables are involved I can't quite get my head around how to do it. Any help would be much appreciated.
PEOPLE......... ........WPH.... ............... .WALKS
...Person_ID... ..........Perso n_ID........... ...Walk_no
...Age......... .......... ..Walk_number.. .......Date
...Suburb_ID... ..........Posit ion............ ...Venue
.....etc....... ..............e tc............. ............etc
Comment