Latest record for each (1 Viewer)

Ianto

New member
Local time
Today, 14:56
Joined
Oct 16, 2009
Messages
3
I have a database with multable entries for each name. I want to run a query that shows only the last entry for each name.
 

Minty

AWF VIP
Local time
Today, 14:56
Joined
Jul 26, 2013
Messages
10,354
What field in the table identifies the record as the "Last one" ?
 

Ianto

New member
Local time
Today, 14:56
Joined
Oct 16, 2009
Messages
3
By date but not all dates are the same
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:56
Joined
May 7, 2009
Messages
19,169
easier if you can add an AutoNumber field to your table.
you can then query the Max() of this field to get the latest name.
eg, ID here is the AutoNumber field:

SELECT T1.MaxOfID AS ID, T1.nameField, yourTable.otherField1, yourTable.otherField2, yourTable.otherField3 FROM (SELECT Max(yourTable.ID) AS MaxOfID, yourTable.nameField
FROM yourTable
GROUP BY yourTable.nameField) T1 INNER JOIN yourTable ON T1.MaxOfID=table2.ID;
 

Users who are viewing this thread

Top Bottom