Below is a sample of the Table
id from to value
1 01.01.20 19.01.20 100
1 20.01.20 31.12.99 100
2 01.01.20 19.01.20 1001
2 25.01.20 31.12.99 1001
3 01.01.20 19.01.20 1002
3 29.01.20 31.12.99 1002
The aim is to retrieve the latest row
The expected output should look like this
id from to value
1 20.01.20 31.12.99 100
2 25.01.20 31.12.99 1001
3 29.01.20 31.12.99 1002
I tried to do something like this:
select *
from test
where id in a
AND from = (select max(from)
from test
where id in a);
However, I am retrieving only one row
3 29.01.20 31.12.99 1002
Thanks for anyone helping!