SQL - Finding the maximum date group by id table
Having a table below, I need to get rows with the maximum date having statut equal 2 REMUN_ID HISTO_ID DATE_MAJ STATUT 2122 7005 08/27/2014 11:10:23 2 1603 5486 08/27/2014 11:10:21 1 2122 5151 08/27/2014 11:08:36 1 1603 4710 08/27/2014 11:08:32 2 I need to get the row with the maximum date and group by REMUN_ID the result using this request select remun_id, max(date_maj) from histo_statut_remun group by remun_id; Result : REMUN_ID DATE_MAJ 2122 08/27/2014 11:10:23 1603 08/27/2014 11:10:21 I need to adjust the request to get only rows with statut = 2 from this result My purpose is to get the