I want to group data according to the eventdate time range for every 2 mins...and have the min recd of that grp,,
meaning i want the result as
1 2007-03-13
1 2007-03-15
1 2007-03-17
and so on...
use tempdb
create table testGroup ( msid int , eventdate datetime )
Insert into testGroup values (1, getDate())
Insert into testGroup values (1, getDate()+1)
Insert into testGroup values (1, getDate()+2)
Insert into testGroup values (1, getDate()+3)
Insert into testGroup values (1, getDate()+4)
Insert into testGroup values (1, getDate()+5)
Insert into testGroup values (1, getDate()+6)
Insert into testGroup values (1, getDate()+7)
Insert into testGroup values (1, getDate()+8)
/*
1 2007-03-13 20:17:22.773
1 2007-03-14 20:17:22.773
1 2007-03-15 20:17:22.773
1 2007-03-16 20:17:22.773
1 2007-03-17 20:17:22.773
1 2007-03-18 20:17:22.773
1 2007-03-19 20:17:22.773
1 2007-03-20 20:17:22.773
1 2007-03-21 20:17:22.773
*/
Start Free Trial