Ver originalSELECT T1.*FROM tabla T1INNER JOIN ( SELECT ItemCode, MAX(ValidFrom) ValidFrom FROM tabla GROUP BY ItemCode) T2 ON T1.ItemCode = T2.ItemCode AND T1.ValidFrom = T2.ValidFrom