Código SQL:
Ver originalDECLARE @H TABLE
(
Serie INT,
Actualizacion SMALLDATETIME
)
--Cita:
INSERT INTO @H VALUES (115, '07-10-2013')
INSERT INTO @H VALUES (115, '08-10-2013')
INSERT INTO @H VALUES (115, '09-10-2013')
--
INSERT INTO @H VALUES (116, '10-10-2013')
INSERT INTO @H VALUES (116, '11-10-2013')
INSERT INTO @H VALUES (116, '12-10-2013')
SELECT serie,actualizacion FROM(
SELECT serie,actualizacion, ROW_NUMBER() OVER(partition BY serie ORDER BY actualizacion DESC) AS rn FROM @h
) t1 WHERE rn<=2
ORDER BY actualizacion
Me gano la respuesta amigo iislas :P
saludos!