y para que un cursor?
porque no pruebas con esto:
Código SQL:
Ver originalCREATE TABLE #temp(
usuario VARCHAR(20),
fecha datetime
)
INSERT INTO #temp VALUES ('yo',GETDATE())
INSERT INTO #temp VALUES ('yo',dateadd(mi,1,GETDATE()))
INSERT INTO #temp VALUES ('yo',dateadd(mi,2,GETDATE()))
INSERT INTO #temp VALUES ('yo',dateadd(mi,3,GETDATE()))
INSERT INTO #temp VALUES ('yo',dateadd(mi,4,GETDATE()))
INSERT INTO #temp VALUES ('yo',dateadd(mi,5,GETDATE()))
INSERT INTO #temp VALUES ('yo1',GETDATE())
INSERT INTO #temp VALUES ('yo1',dateadd(mi,1,GETDATE()))
INSERT INTO #temp VALUES ('yo1',dateadd(mi,2,GETDATE()))
INSERT INTO #temp VALUES ('yo1',dateadd(mi,3,GETDATE()))
INSERT INTO #temp VALUES ('yo1',dateadd(mi,4,GETDATE()))
INSERT INTO #temp VALUES ('yo1',dateadd(mi,5,GETDATE()))
INSERT INTO #temp VALUES ('yo2',GETDATE())
INSERT INTO #temp VALUES ('yo2',dateadd(mi,1,GETDATE()))
INSERT INTO #temp VALUES ('yo2',dateadd(mi,2,GETDATE()))
INSERT INTO #temp VALUES ('yo2',dateadd(mi,3,GETDATE()))
INSERT INTO #temp VALUES ('yo2',dateadd(mi,4,GETDATE()))
INSERT INTO #temp VALUES ('yo2',dateadd(mi,5,GETDATE()))
SELECT usuario,fecha FROM #temp WHERE fecha IN (SELECT MAX(fecha) FROM #temp GROUP BY usuario)
saludos!