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 |
|
php95saj
Starting Member
43 Posts |
Posted - 2002-12-09 : 11:52:35
|
| GuysI have a tabe which is storing user response round the clock. I am using GetDate() to store DateTimeStamp I want to build a report that would generate a report on hourly basis. i.e. During 8-9 099-10 13410-11 205711-12 2937something like that.ThanksSharjeel |
|
|
colinm
Yak Posting Veteran
62 Posts |
Posted - 2002-12-09 : 12:02:07
|
| Use the datepart function.i.e.SELECT DATEPART(hh,DateTimeStamp) AS HOUR, COUNT(*) AS TOTAL FROM tblGROUP BY DATEPART(hh,DateTimeStamp) |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2002-12-09 : 13:24:45
|
| Alternate.SELECT datediff(hh,dateadd(dd,datediff(dd,0,DateTimeStamp),0),DateTimeStamp) As HOUR, COUNT(*) AS TOTALFROM TblGROUP BY datediff(hh,dateadd(dd,datediff(dd,0,LastAccessed),0) ,LastAccessed) |
 |
|
|
|
|
|
|
|