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 |
|
thotef
Starting Member
3 Posts |
Posted - 2009-03-06 : 07:57:06
|
| Hi there!I´m using this sql-statement now and it works fine but seems to be a bit slow when the amount of data is increased (of course it should be slower but not that much slower as I can see it).This is what I use today:SELECT DISTINCT { fn HOUR(Date_Time) } AS myHour, COUNT(*) AS NrOfHits FROM SmsGenEvents WHERE Department IS NOT NULL GROUP BY { fn HOUR(Date_Time) } ORDER BY { fn HOUR(Date_Time) }The result is:0 106 307 18618 310709 3546310 4931211 4824412 2416413 5071714 3468915 5141216 2588517 319118 153019 109620 94221 39322 18123 108Can this be done in a better way?Any suggestions are welcome and I will performancetest everyone of them that will give me the same result and post back what I figured out!Thank You in advance! // TT |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-06 : 08:36:48
|
Replace all odbc calls with DATEPART(HOUR, Date_Time) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|