sql >> Base de Datos >  >> RDS >> Sqlserver

obtenga solo la última fila en las entradas múltiples de cada día en TSQL

;with cte as
(
  select
    *,
    row_number() over(partition by datediff(d, 0, EnteredOn) order by EnteredOn desc) as rn 
  from YourTable
)
select *
from cte  
where rn = 1