Assume i have table A:
id: name: timestamp:
1 Bob 2018-05-31 04:46:37
2 Alice 2019-01-31 07:13:56
1 Bob 2019-01-15 18:23:74
And i want to join with another table B:
id: name: Preference:
1 Bob Car
2 Alice Bike
ID alone isnt a primary key. however ID + timestamp IS an unique key. However, how would i make to only join the 1 part of the duplicate, that has a the newest date? So that i would get a joined table like:
id: name: Preference: Timestamp:
1 Bob Car 2019-01-15 18:23:34
2 Alice Bike 2019-01-31 07:13:56
By if i have duplicates, then compare the date between the duplicates and choose the newst