I have two tables with one-to-many relationship. One is called Staff and the other is Observation.
Staff enter observations into the Observation table.
I would like a form which displays a list of each staff member and the date they last entered an Observation.
There is a field in the Observation table called observeDate but I need the query to pull out the most recent observeDate for each member of staff.
Lothario has kindly suggested using the following query but it requires the user to enter the staffID at run time.
SELECT t1.StaffName,t2.ObserveDate
FROM Staff t1, Observation t2
WHERE t1.StaffId=T2.StaffId AND t2.ObserveDate In (select top 1 t3.ObserveDate from Observation t3 where t3.StaffID = t2.StaffID ORDER BY t3.ObserveDate Desc);
I actually want to display a list of all staff on a form and a date for each.
Many Thanks
Daniel
Staff enter observations into the Observation table.
I would like a form which displays a list of each staff member and the date they last entered an Observation.
There is a field in the Observation table called observeDate but I need the query to pull out the most recent observeDate for each member of staff.
Lothario has kindly suggested using the following query but it requires the user to enter the staffID at run time.
SELECT t1.StaffName,t2.ObserveDate
FROM Staff t1, Observation t2
WHERE t1.StaffId=T2.StaffId AND t2.ObserveDate In (select top 1 t3.ObserveDate from Observation t3 where t3.StaffID = t2.StaffID ORDER BY t3.ObserveDate Desc);
I actually want to display a list of all staff on a form and a date for each.
Many Thanks
Daniel