2017-08-16 SQL update latest entry Update rows according to an effective date. 123456789UPDATE table SET activo = 0 FROM table t1INNER JOIN (SELECT id,max(fechamodificacion) as LatestDate FROM table GROUP BY id) t2 ON t1.id = t2.id and t1.fechamodificacion < t2.LatestDate--for last row only use: t1.fechamodificacion = t2.LatestDate--where Newer Bug on Git Jul 2017 Older Broadpwn