I need to find the largest and smallest values in a table based on the Primary Key for each record in a query.
For example.
Table1
ID
A
B
C
Table2
ID - Num
A - 1
A - 2
A - 3
B - 1
B - 2
B - 3
B - 4
C - 1
C - 2
I need it to return:
A - 1 | 3
B - 1 | 4
C - 1 | 2
I have searched through the site already and not found anything that I can get to work. I'm basically telling the query to select all Table1.ID and select Table2.Num only where it is equal to Table1. But I need to select only the max number. I'm close using this for the criteria.
=DMax("[Num]","Table2")
But I need to link it to the ID in Table1, otherwise it only returns one row, the highest in the entire table. I can't seem to find any combination of criteria to get it to work (ie: =Dmax("[Num]",Table2","[Table2.ID] = [Table1.ID]")
Any suggestions?
Thanks
For example.
Table1
ID
A
B
C
Table2
ID - Num
A - 1
A - 2
A - 3
B - 1
B - 2
B - 3
B - 4
C - 1
C - 2
I need it to return:
A - 1 | 3
B - 1 | 4
C - 1 | 2
I have searched through the site already and not found anything that I can get to work. I'm basically telling the query to select all Table1.ID and select Table2.Num only where it is equal to Table1. But I need to select only the max number. I'm close using this for the criteria.
=DMax("[Num]","Table2")
But I need to link it to the ID in Table1, otherwise it only returns one row, the highest in the entire table. I can't seem to find any combination of criteria to get it to work (ie: =Dmax("[Num]",Table2","[Table2.ID] = [Table1.ID]")
Any suggestions?
Thanks