G
Guest
Hi There
Seem to be having trouble finding the most recent date on one of my tables.
I have a table I call [Equipment Rotation History] I keep a running record
of [Equipment ID] and the location’s [Location ID] that the Equipment has
been at. When I print my reports for the Equipment I need the most recent
date that the Equipment has been moved.
If I keep entering the dates that I move the Equipment in order the
following query so far has worked OK.
SELECT [Equipment Rotation History].[Equipment ID], Last([Equipment Rotation
History].[Location ID]) AS [LastOfLocation ID], Last([Equipment Rotation
History].[Date Installed]) AS [LastOfDate Installed]
FROM [Equipment Rotation History]
GROUP BY [Equipment Rotation History].[Equipment ID];
But if some time goes buy and I don’t stay on top of my paper work I may not
enter the dates of the moves in order and my report will not reflect the most
recent date for the Equipment and Location.
So I tried using this query WHERE I’m trying to SELECT the MAX [Date
Installed] but for some reason it just doesn’t work.
SELECT [Equipment ID], [Location ID], [Date Installed]
FROM [Equipment Rotation History]
WHERE [Date Installed] In (SELECT MAX([Date installed]) FROM [Equipment
Rotation History] GROUP BY [Equipment ID]);
Any ideas???
I need help Please
Seem to be having trouble finding the most recent date on one of my tables.
I have a table I call [Equipment Rotation History] I keep a running record
of [Equipment ID] and the location’s [Location ID] that the Equipment has
been at. When I print my reports for the Equipment I need the most recent
date that the Equipment has been moved.
If I keep entering the dates that I move the Equipment in order the
following query so far has worked OK.
SELECT [Equipment Rotation History].[Equipment ID], Last([Equipment Rotation
History].[Location ID]) AS [LastOfLocation ID], Last([Equipment Rotation
History].[Date Installed]) AS [LastOfDate Installed]
FROM [Equipment Rotation History]
GROUP BY [Equipment Rotation History].[Equipment ID];
But if some time goes buy and I don’t stay on top of my paper work I may not
enter the dates of the moves in order and my report will not reflect the most
recent date for the Equipment and Location.
So I tried using this query WHERE I’m trying to SELECT the MAX [Date
Installed] but for some reason it just doesn’t work.
SELECT [Equipment ID], [Location ID], [Date Installed]
FROM [Equipment Rotation History]
WHERE [Date Installed] In (SELECT MAX([Date installed]) FROM [Equipment
Rotation History] GROUP BY [Equipment ID]);
Any ideas???
I need help Please