sistemalan
Registered User.
- Local time
- Today, 01:31
- Joined
- Jun 19, 2009
- Messages
- 77
Hi there,
I am trying to create a query which will show only the oldest child from each family.
I have built a totals query which groups by guardianID (which defines their parent) and shows the minimum date of birth (therefore of the oldest child). Or at least it should. Whenever I view this query it does not show the most hostoric date of birth it shows the earliest one alphabetically. Therefore 04/02/2001 comes before 22/09/1999 and therefore the wrong child is selected.
The DateOfBirth field is absolutely positively a date field.
Any thoughts on how I could fix this problem?
The SQL for the query is as follows:
I'm really beginning to pull my hair out with this one. Thanks to anyone taking the time to help.
I am trying to create a query which will show only the oldest child from each family.
I have built a totals query which groups by guardianID (which defines their parent) and shows the minimum date of birth (therefore of the oldest child). Or at least it should. Whenever I view this query it does not show the most hostoric date of birth it shows the earliest one alphabetically. Therefore 04/02/2001 comes before 22/09/1999 and therefore the wrong child is selected.
The DateOfBirth field is absolutely positively a date field.
Any thoughts on how I could fix this problem?
The SQL for the query is as follows:
Code:
SELECT Q_AttendingAfterSchool.AdultID, Q_AttendingAfterSchool.AdultName, Min(Q_AttendingAfterSchool.DateOfBirth) AS MinOfDateOfBirth
FROM Q_AttendingAfterSchool
GROUP BY Q_AttendingAfterSchool.AdultID, Q_AttendingAfterSchool.AdultName;