Código SQL:
Ver originalCREATE TABLE #temp(
codigo VARCHAR(20),
anyo INT,
mes INT,
fecha datetime
)
--CODIGO ANYO MES FECHA
INSERT INTO #temp VALUES ('C-1111', 2013, 1, '2013-12-06 17:58:00')
INSERT INTO #temp VALUES ('C-1111', 2012, 12, '2013-12-06 17:46:00')
INSERT INTO #temp VALUES ('P-2222', 2014, 1, '2013-09-05 15:41:00')
INSERT INTO #temp VALUES ('M-1112', 2013, 1, '2013-26-04 10:59:00')
DELETE FROM #temp
SELECT * FROM #temp WHERE CONVERT(VARCHAR(20),codigo) + '|' + CONVERT(VARCHAR(20),fecha) IN (
SELECT CONVERT(VARCHAR(20),codigo) + '|' + CONVERT(VARCHAR(20),MAX(fecha)) FROM #temp GROUP BY codigo
)
saludos!