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 |
|
lemondash
Posting Yak Master
159 Posts |
Posted - 2008-12-16 : 10:04:37
|
| I have a question and hopefully somebody could help me. I have a table and one of colunms is datendtime and every time a user downloads data it inserts a record. What i need to do is see if how many downloads are happening per second from the dateandtime colunm.My out put should be like this or i would like it like this:Dateandtime,How many downlaods in that second2007-05-08 12:35:29,3Can a group by do this ? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-16 : 10:14:32
|
[code]SELECT DATEADD(SECOND, DATEDIFF(SECOND, '2000-01-01', DateAndTime), '2000-01-01'), COUNT(*)FROM Table1GROUP BY DATEADD(SECOND, DATEDIFF(SECOND, '2000-01-01', DateAndTime), '2000-01-01')ORDER BY DATEADD(SECOND, DATEDIFF(SECOND, '2000-01-01', DateAndTime), '2000-01-01')[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-16 : 10:14:53
|
| [code]SELECT DATEADD(dd,DATEDIFF(dd,0, datendtime),0) AS Date,DATEDIFF(ss,DATEADD(dd,DATEDIFF(dd,0, datendtime),0),datendtime) AS TimePassed,COUNT(*)FROM TableGROUP BY DATEADD(dd,DATEDIFF(dd,0, datendtime),0),DATEDIFF(ss,DATEADD(dd,DATEDIFF(dd,0, datendtime),0),datendtime)[/code] |
 |
|
|
|
|
|
|
|