I have a table with a multi-column primary key (city/state/date) and many more columns of data. I\'m looking to get the latest data for each city/state. How do I do that cleanly
I think this should do the trick for you:
select * from data t1 natural join ( select city, state, max(date) as date from data group by city, state ) t2;