ID | Payment | year |
---|---|---|
A | 10 | 1 |
A | 15 | 2 |
A | 12 | 3 |
B | 11 | 2 |
B | 15 | 4 |
C | 25 | 1 |
C | 17 | 3 |
I'm looking for a query that returns a row for each ID for its last year. The year column is ordered increasing for each ID.
ID | Payment | year |
---|---|---|
A | 12 | 3 |
B | 15 | 4 |
C | 17 | 3 |
select ID, Payment, Year from payment_table
where year = (select max(year) from ?????????);
what shall I write instead of "????????"?