Ver originalSELECT *FROM (SELECT ROW_NUMBER() OVER(Partition BY Cliente ORDER BY Fecha DESC, Hora DESC) N, * FROM #temp) TWHERE N=1;