i have a problem with a specific selection in a table. In would like to find all Persons grouped by Name with the max year. But I need also the other columns, for a later join, in the result set.
Furthermore, the id is unordered, so it can not be used in an aggregate function. The query should be database agnostic.
Here is the Table:
Here is the Result that I need:
You can try below- using correlated subquery
select * from tablename a
where year = (select max(year) from tablename b a.name=b.name)