I have a table with
EMPLOYEE_CODE,
ENTITLEMENT_CODE,
TRANS_DATE,
UNIQUE_ID,
HOURS.
I need to get the HOURS for the maximum TRANS_DATE for each combination of EMPLOYEE_CODE, ENTITLEMENT_CODE but it is possible there will multiple occurances of the maximum TRANS_DATE so I need to further refine to query to get the maximum of the UNIQUE_ID and hence the HOURS for this particular row that returned. I've tried various methods but I can get part of the query but not the whole thing together.
So I might have something like:
EMPLOYEE_CODE, ENTITLEMENT_CODE, TRANS_DATE, UNIQUE_ID, HOURS.
-----------------------------------------------------------------
2305 ANNL 04/15/2014 28547 15.55
2305 ANNL 04/15/2014 28622 16.83
2305 ANNL 04/15/2014 28223 18.62
2305 ANNL 04/08/2014 28111 12.22
2305 SICK 04/12/2014 28150 14.47
2305 SICK 04/12/2014 28162 12.44
2305 SICK 03/11/2014 28062 18.66
So this would need to return
16.83 for 2305 ANNL
12.44 for 2305 SICK
Any help much appreciated.