I have this table:
Department NAME EMAIL ID DATE1 DATE2 1 John asd@asd.com 74 05/04/2007 05/04/2007 1 Sam asd@asd.com 23 05/04/2007 05/04/2007 1 Tom asd@asd.com 46 05/04/2007 03/04/2007 1 Bob bob@asd.com 23 01/01/2006 2 Tom asd@asd.com 62 02/02/2000 05/05/1997
I want to get a row (only one per department) with max DATE1 , but it is not unique! Therefore, if there are several results, I want to get max DATE2 , and if there are several, the one with the largest identifier is returned.
Thus, the query result will be:
1 John asd@asd.com 74 05/04/2007 05/04/2007 2 Tom asd@asd.com 62 02/02/2000 05/05/1997
Many thanks.
source share