Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-02-14 : 08:33:02
|
Rameez writes "I'm looking for a way to group consecutive records. I have a table called Data with two fields; a primary key 'Time' which is a datetime and 'Value' which is a decimal. See below:---------------------------------------- Time | Value |----------------------------------------2/6/2007 02:05:00.333 3.82/6/2007 02:10:00.333 3.82/6/2007 02:15:00.333 9.02/6/2007 02:20:00.333 9.02/6/2007 02:25:00.333 9.02/6/2007 02:30:00.333 3.82/6/2007 02:35:00.333 3.8I want to be able to group by min(Time) and Value, but only those records that are consecutive. So from the data set i supplied i should be able to obtain the following data:---------------------------------------- Time | Value |----------------------------------------2/6/2007 02:05:00.333 3.82/6/2007 02:15:00.333 9.02/6/2007 02:30:00.333 3.8Any ideas? I've been trying to solve this for ages." |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|