Usted puede probar este codigo para selectar las ID unicas con la fechas más recientes de la tabla Gestion. ``` SELECT G2.ID, G1.fechaMx, G2.Codigo_Resultado AS coderesult FROM ( ( SELECT ID, MAX( [Fecha de gestion] ) AS fechaMx FROM Gestion GROUP BY ID ) AS G1 JOIN Gestion AS G2 ON G1.ID = G2.ID AND G1.fechaMx = G2.([Fecha de gestion]) ) AS G3 ``` Si tiene comprobar con un solo ID ``` SELECT * FROM ( SELECT G2.ID, G1.fechaMx, G2.Codigo_Resultado AS coderesult FROM ( ( SELECT ID, MAX( [Fecha de gestion] ) AS fechaMx FROM Gestion GROUP BY ID ) AS G1 JOIN Gestion AS G2 ON G1.ID = G2.ID AND G1.fechaMx = G2.([Fecha de gestion]) ) AS G3 ) WHERE ID = 976 ``` Nota: No tengo el recurso apropriado para comprobar el syntax o la resulta de este codigo, asi hay posibilidades que tiene errores. Si encuentra errores, tiene que fijarlos antes de probar el query update. Update: ``` UPDATE A SET A.Ultima_Gestion = G3.coderesult FROM ( Asignado AS A JOIN SELECT G2.ID, G1.fechaMx, G2.Codigo_Resultado AS coderesult FROM ( ( SELECT ID, MAX( [Fecha de gestion] ) AS fechaMx FROM Gestion GROUP BY ID ) AS G1 JOIN Gestion AS G2 ON G1.ID = G2.ID AND G1.fechaMx = G2.([Fecha de gestion]) ) AS G3 ON A.ID = G3.ID ) ```