Latest Record

  • Thread starter Thread starter glnbnz
  • Start date Start date
G

glnbnz

I would like to build a query that pulls the last record entered from the
table. Let's say that I have 4 records for "mywell" with 4 different dates
and I just want the last record. I can do query like this:

SELECT MAX([Datefield]) as LatestDate
FROM mytable

That works until there is a difference in any of the other fields. Then
that record is listed also.
I just want the last record for "mywell" no matter if any of the fields are
different or not. Could anyone please help me with this??

Thank you
glnbnz
 
I'm sorry, Jerry, I should have been a little more specific. I did what you
told me and that returns the absolute last one. I have more than one
"mywell"s in the table. I would like to pull the latest one for each.
Thanks
glnbnz

Jerry Whittle said:
Select Top 1 *
FROM mytable
ORDER BY [Datefield] DESC ;
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

glnbnz said:
I would like to build a query that pulls the last record entered from the
table. Let's say that I have 4 records for "mywell" with 4 different dates
and I just want the last record. I can do query like this:

SELECT MAX([Datefield]) as LatestDate
FROM mytable

That works until there is a difference in any of the other fields. Then
that record is listed also.
I just want the last record for "mywell" no matter if any of the fields are
different or not. Could anyone please help me with this??

Thank you
glnbnz
 
Back
Top