Hi folksI'm currently developing a statistics report generation system, that has it's front-end in ASP.NET which then queries a MS SQL Server 2000 database.Here is an example of a stored procedure used to work out the total number of visitors per day, over a given date period.CREATE PROCEDURE sppb_GandalfStats_TotalVisitors@DateFrom DATETIME,@DateTo DATETIME,@NoDateSpan BIT/****************************************************************************************31 January 2005 - Created - Peter BridgerGet website visitor stats for a time period***************************************************************************************/ASSET NOCOUNT ONIF @NoDateSpan = 1 BEGIN SELECT @DateFrom = '2000/01/01' SELECT @DateTo = '2100/01/01'ENDSELECT COUNT(*) 'TotalVisitors',CONVERT( DATETIME, CONVERT( CHAR(10), StartDatetime, 101 ) ) 'Date'FROMVisitorsWHEREStartDatetime >= @DateFrom AND StartDatetime <= DATEADD( dd, 1, @DateTo )GROUP BYCONVERT( DATETIME, CONVERT( CHAR(10), StartDatetime, 101 ) )ORDER BYCONVERT( DATETIME, CONVERT( CHAR(10), StartDatetime, 101 ) ) ASC/* EOF */GO
This works fine, although if there's a better way to do this, please let me know
However I also need to write a procedure to work out how many people are using which type of browsers for a given time period.Here is the code I thought would work, but doesn't.SELECT COUNT(*),L_BT.ShortNameFROMVisitors AS VLEFT JOINLookup_BrowserTypeID AS L_BT ONL_BT.BrowserTypeID = V.BrowserTypeIDWHEREV.StartDatetime >= @DateFrom AND V.StartDatetime <= DATEADD( dd, 1, @DateTo )GROUP BYCOUNT(*),L_BT.ShortName
The problem being, it doesn't like the COUNT(*) statements used.All I'm after is a list of browsers and the number of times they were logged for the date period requested.E.g.MSIE, 544Mozilla, 232 Thanks if you can help me out