Question : Access 2000 - Top Nth function

I am hoping this is a simple problem.  I have a database with a query that shows a unit number, and then every event log entry for that unit.  I am looking to have it return just the most recent result for each unit number.  The query basically looks like this:

SELECT DISTINCT product.unit_number, log.create_date
FROM (Product LEFT JOIN Log ON Product.unit_number = log.Unit_Number)
WHERE Product.Unit_Number = "Variable"
ORDER BY Product.Unit_Number

If I use a SELECT TOP 1 then I just get a single Unit Number returned.  Any help would be much appriciated.  If this question is not as easy as I believe it should be, I will raise the points offered accordingly.

Answer : Access 2000 - Top Nth function

Try this it should select the max date or the highest date.

SELECT DISTINCT product.unit_number, max(log.create_date) as Create_Date
FROM (Product LEFT JOIN Log ON Product.unit_number = log.Unit_Number)
WHERE Product.Unit_Number = "Variable"
ORDER BY Product.Unit_Number


Cheers
Marcus
Random Solutions  
 
programming4us programming4us