User login

MetaTraffic 2.0 Boxshot

GetMaxHourlyPageViews() Function

Posted by Daniel [July 16, 2003]

Good day,

Part of my customization process, I modified the GetMaxHourlyPageViews() function to accomodate a special need. I wanted to get the Maximum number of hits within a given hour, but also I wanted to know, the hour on which that quantity was reached.

So I created a simple MsAccess query to do it.

However, I can't make an MSSQL query equivalency to that one, since I simply because I don't have access to MSSQL.

Would someone be kind enough to adapt the following query to MSSQL ?

strSql="SELECT LogHH, MAX(HourCount) " &_
"FROM (SELECT DATEPART(""h"",pl_datetime) AS LogHH, COUNT(pl_scriptname) AS HourCount " &_
"FROM " & strInstance & "PageLog " &_
"WHERE pl_scriptname<>'' " &_
"GROUP BY DATEPART(""h"",pl_datetime)) dt_PageLog " &_
"GROUP BY LogHH " &_
"ORDER BY 2 DESC"

I think the following should work, but I can't confirm :

strSql="SELECT LogHH, MAX(HourCount) " &_
"FROM (SELECT DATEPART(hh,pl_datetime) AS LogHH, COUNT(pl_scriptname) AS HourCount " &_
"FROM " & strInstance & "PageLog " &_
"WHERE pl_scriptname<>'' " &_
"GROUP BY DATEPART(hh,pl_datetime)) dt_PageLog " &_
"GROUP BY LogHH " &_
"ORDER BY 2 DESC"

Best Regards.

GetMaxHourlyPageViews() Function

Hi Daniel,

I've moved this post since its not really a support issue, more of an enhancement.

Regards,
~Chad