There is probably be another query to do this more efficiently, but for the
third to last landing overall, you might try a query whose SQL looks
something like this:
SELECT
Max([Your Table].[Flight Date]) AS [Flight Date of Third to Last Landing]
FROM
[Your Table]
WHERE
(SELECT
Sum([Self].[Landings])
FROM
[Your Table] AS [Self]
WHERE
[Self].[Flight Date] >= [Your Table].[Flight Date]) >= 3
Likewise, for the third to last landing for each pilot, you might try a
query whose SQL looks something like this:
SELECT
[Your Table].[Pilot Name],
Max([Your Table].[Flight Date]) AS [Flight Date of Third to Last Landing]
FROM
[Your Table]
WHERE
(SELECT
Sum([Self].[Landings])
FROM
[Your Table] AS [Self]
WHERE
[Self].[Pilot Name] = [Your Table].[Pilot Name]
AND
[Self].[Flight Date] >= [Your Table].[Flight Date]) >= 3
GROUP BY
[Your Table].[Pilot Name]
Ed Finley said:
I'm sure there's an easier way to do this. I have a table of pilot names,
flight dates, and number of landings that day. I'm trying to get a
query
or
VB routine to give me the date of the third to last landing.
Any help will be appreciated.
Ed