with cte as
(
select *
-- get min & max per date
,min(time) over (partition by cast(time as date)) as mintime
,max(time) over (partition by cast(time as date)) as maxtime
from tab
)
select *
from cte
where time in (mintime,maxtime)
1
solved how can i show the last event of each date in sql [closed]