J
JohnM77 via AccessMonster.com
Consider the following scenario:
Two tables:
tParent
tParent.ID (Autonumber)
tChild
tChild.ID (Autonumber)
tParent.ID (Many-to-One relationship to tParent.ID)
tParent Records:
ID
1
2
3
4
5
6
tChild Records:
tChild.ID tParent.ID
1 1
2 1
3 2
4 3
5 4
I wish to create a Query that would show the following results:
tChild.ID tParent.ID
1 1
3 2
4 3
5 4
6 Null
where only one record is shown for each tParent.ID, and in cases where there
is more than one child record for a given tParent.ID (as is the case for
tParent.ID = 1), the query only includes the record for one of the tChild.ID
values (in this case, tChild.ID = 1).
Basically, I have a situation that is the same as this hypothetical scenario,
in which the vast majority of tParent.ID records have only one (if any)
reference in tChild. My query must only display each tParent record one time,
but it needs to show a corresponding tChild.ID for reference (accepting that,
on the rare occasion, some tChildID values will be omitted when there are
multiple tChild.ID's for a given tParent.ID).
Is there a simple way to acheive this result? Any thoughts/suggestions are
greatly appreciated.
Thanks,
John
Two tables:
tParent
tParent.ID (Autonumber)
tChild
tChild.ID (Autonumber)
tParent.ID (Many-to-One relationship to tParent.ID)
tParent Records:
ID
1
2
3
4
5
6
tChild Records:
tChild.ID tParent.ID
1 1
2 1
3 2
4 3
5 4
I wish to create a Query that would show the following results:
tChild.ID tParent.ID
1 1
3 2
4 3
5 4
6 Null
where only one record is shown for each tParent.ID, and in cases where there
is more than one child record for a given tParent.ID (as is the case for
tParent.ID = 1), the query only includes the record for one of the tChild.ID
values (in this case, tChild.ID = 1).
Basically, I have a situation that is the same as this hypothetical scenario,
in which the vast majority of tParent.ID records have only one (if any)
reference in tChild. My query must only display each tParent record one time,
but it needs to show a corresponding tChild.ID for reference (accepting that,
on the rare occasion, some tChildID values will be omitted when there are
multiple tChild.ID's for a given tParent.ID).
Is there a simple way to acheive this result? Any thoughts/suggestions are
greatly appreciated.
Thanks,
John