Get max date for each year from list of dates

dategroup bysql-standard

Need to get max date for each year from list of arbitrary dates:

date         year
=================
1/10/2013    2013
3/26/2013    2013
4/20/2012    2012
9/10/2012    2012
5/6/2011     2011

So with a working query, using the above data, the correct result would be:

maxdate     year
=================
3/26/2013    2013
9/10/2012    2012
5/6/2011     2011

Our database is proprietary, supporting only ANSI-SQL, no fancy extensions.
Tried using group_by, but it's retrieving all dates for each year, not what I want.

Best Answer

It is possible that I am missing something, but you should be able to get the result easily using the max() aggregate and a GROUP BY:

select
  max(date) maxdate,
  year
from yourtable
group by year;

See SQL Fiddle with Demo