Solved Show Last Record in Query by Date

theinviter

Registered User.
Local time
Today, 02:07
Joined
Aug 14, 2014
Messages
273
Dears;
Need help,
How to filter the query to show only last record by date, as the filed name DATE_.

thanks
 
you create another query (qry1) that will retrieve PK number and the Max of date:

select [PK field], Max([yourDateField]) As MaxOfDate from yourTable;

now join this qry to your Original query and join them on the two fields.
 
Can be done 1 query.
Code:
SELECT TOP 1 * FROM YourTable ORDER BY DATE_ DESC

Even arnelgp's solution can be done In one query using a sub-query.
 
Even arnelgp's solution can be done In one query using a sub-query
your query will return only 1 record?
what if there are many PKs/Date on the table?
 
your query will return only 1 record?
what if there are many PKs/Date on the table?
Then only one record will be shown.
The wish was "only last record by date". So 1 record.

Edit: If the time parts of a same date differ, your query will also select 1 record.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom