How to extract latest record

G

Guest

I have a table with following fields:-
[Repair ID]; [Date]; [Location]

I need to extract the latest/newest LOCATION for each repair based on newest
date per repair. I have been sitting with this for some time now and just
cant seem to find the answer...

I thank you in advance for all your assistance!!!
 
R

Rick Brandt

Rene said:
I have a table with following fields:-
[Repair ID]; [Date]; [Location]

I need to extract the latest/newest LOCATION for each repair based on
newest date per repair. I have been sitting with this for some time
now and just cant seem to find the answer...

I thank you in advance for all your assistance!!!

SELECT A.[Repair ID], A.Location
FROM TableName A
WHERE (((A.Date) In (SELECT Max(B.Date) FROM TableName B WHERE B.[Repair ID]
= A.[Repair ID])));
 
R

Rick Brandt

Rick said:
Rene said:
I have a table with following fields:-
[Repair ID]; [Date]; [Location]

I need to extract the latest/newest LOCATION for each repair based on
newest date per repair. I have been sitting with this for some time
now and just cant seem to find the answer...

I thank you in advance for all your assistance!!!

SELECT A.[Repair ID], A.Location
FROM TableName A
WHERE (((A.Date) In (SELECT Max(B.Date) FROM TableName B WHERE
B.[Repair ID] = A.[Repair ID])));

I should have added that "Date" is a reserverd word in Access and as such
should never be used as the name of a field or object. Change to RecordDate
or similar.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top