I have a database to keep records of teachers at a school. on a report, I need to limit professional development to ones with a date equal to or after their license was issued. I can do that. But for teachers who have multiple licenses it will duplicate the PD for each license issue date.
I have created a query that pulls the staffID from a demographics table, the professional development info form the PD table, and the license issued dates from the license table. On the license table the staffID may be listed twice if they have more than one license, are are usually issued on the same date.
How do I create a query that will just take the first license record for each staffID and pass it to another query so I can use ">= teacherLicense.DateIssued" for PD date?
Here is what I have tried so far:
SELECT [tbl_Teacher Licenses].[staffID], [tbl_Teacher Licenses].[date issued], [tbl_Teacher Licenses].[ID]
FROM [tbl_Teacher Licenses]
WHERE [tbl_Teacher Licenses].[ID] IN
(SELECT TOP 1 [tbl_Teacher Licenses].[ID]
FROM [tbl_Teacher Licenses] AS [Dupe]
WHERE [Dupe].[staffID]=[tbl_Teacher Licenses].[staffID]
ORDER BY [Dupe].[date issued] DESC, [Dupe].[ID] DESC);
Any help would be greatly appreciated.