The table is laid out like
name, id, attr1, attr2, data_date a, 1, sals, ksdjf, 05-25-2018 b, 1, laskd, lskd, 05-20-2017 c, 2, klss, kjfe, 03-20-2018 d, 2, aow , lww , 02-10-2018 .....
select name, id, attr1, attr2, data_date from table1 where (id,data_date) in (select id, max(data_date) from table1 group by id)
The above query works. Essentially for each ID, I want to select the row with the max( data_date ). I am sure there is a better way with analytic functions.
Results of my query should bename, id, attr1, attr2, data_date a, 1, sals, ksdjf,05-25-2018 c, 2, klss, kjfe, 03-20-2018
Appreciate any help to rewrite it better. Thank you.