I have a database table containing the following columns:
id code value datetime timestamp
In this table the only unique values res
I'll try something like this :
select * from table where id in ( select id from table group by code having datetime = max(datetime) )
(disclaimer: this is not tested)
If the row with the bigger datetime also have the bigger id, the solution proposed by smdrager is quicker.