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 |
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2010-01-15 : 04:36:21
|
| i have some data which comes in every 1 min in my table and this comes for 24 hours a day. I like to get data which is group by every 10 mins.Like...Seq count datetime1 78 2010-01-01 00:02:00.0002 54 2010-01-01 00:04:00.0003 21 2010-01-01 00:06:00.0004 21 2010-01-01 00:08:00.0005 7 2010-01-01 00:10:00.0006 54 2010-01-01 00:12:00.0007 48 2010-01-01 00:14:00.0008 48 2010-01-01 00:16:00.0009 47 2010-01-01 00:18:00.00010 78 2010-01-01 00:20:00.000 Then output must be likeTime Count2010-01-01 00:10:00.000 1812010-01-01 00:20:00.000 275thhis will go for whole day?iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-15 : 04:40:35
|
| [code]select dateadd(mi,((datediff(mi,0,datetime)-1/10) + 1)*10,0),sum([count]) as [count]from tablegroup by dateadd(mi,((datediff(mi,0,datetime)-1/10) + 1)*10,0)order by dateadd(mi,((datediff(mi,0,datetime)-1/10) + 1)*10,0)[/code] |
 |
|
|
|
|
|