Ver originalSELECT * FROM (SELECT *FROM tabla1WHERE codigo=8ORDER BY fecha DESCLIMIT 1) Sbc1 UNION ALL (SELECT *FROM tabla1WHERE codigo=10ORDER BY fecha DESCLIMIT 1) Sbc2) derivedTable;