I have a data in my table like this
001800081 2020-05-19 11:59:04.720
001800081 2020-05-19 12:01:51.997
001800081 2020-05-19 22:03:58.627
001800081 2020-05-19 22:04:03.190
I want to sql query result like this
001800081 2020-05-19 12:01:51.997
001800081 2020-05-19 22:03:58.627
I want to select distinct data based on range time ,
for every data have 1 hour range example
first row has 2 minutes range with second row ,
i want to select 1 of them as the result ,
Second row has 10 hour range with third row ,so i want to select both ,
Third row has 2 minutes range with fourth row ,so i want to select 1 of them ,
I just want to select one data for every data have datetime range < 5 minutes
How can i solve this?
What I have tried:
this is my query ,
it's not complete yet
Select ROW_NUMBER() Over (Order by Timer_finger asc) as 'rownum' ,a.* from
T_Finger_Log a where CONVERT(Date,Insert_Date) = CONVERT(date,getdate())