Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Query - returning latest date/time from multiple records

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
IanB - 09 Nov 2005 04:12 GMT
I have a mental block!

I have a table with 2 fields.
A location field (text 4)
A date/time stamp field (Date/Time)
I can have multiple records for the same location.
I need to extract  from all the location fields, only 1 record per location,
that being the newest date/time.

I can do this in code but there must be an SQL selection that will produce
the same result!
Any help apreciated

TIA

Ian B
Ken Snell [MVP] - 09 Nov 2005 04:26 GMT
SELECT * FROM Tablename
WHERE Tablename.DateTimeField =
(SELECT Max(T.DateTimeField)
FROM Tablename AS T
WHERE T.LocationField = Tablename.LocationField);

Signature

       Ken Snell
<MS ACCESS MVP>

>I have a mental block!
>
[quoted text clipped - 13 lines]
>
> Ian B
IanB - 09 Nov 2005 04:44 GMT
Ken

Thats great - thanks for your help

Ian B

> SELECT * FROM Tablename
> WHERE Tablename.DateTimeField =
[quoted text clipped - 24 lines]
> >
> > Ian B
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.