|
-
Feb 13th, 2009, 05:04 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] SQL Server '05: Query Browser Usage stats
Hi,
I'm trying to write a query to get the browser usage stats on my site. I know that these are very difficult to get right but I'm looking for the best that I can have based on the information I'm collecting.
I have the following fields in an activities table. A row is inserted each time a user successfully logs in (I'm using browser hawk to extract the browser specific information)
Act_Id, User_Id, User_Name, Application, Act_Date, HTTP_User_Agent, IP_Address, Platform, Browser, Browser_Full_Ver, Browser_Major_Ver, Browser_Minor_Ver
This is what I have so far -
Code:
SELECT Browser, Browser_Major_Ver, COUNT(*) AS Usage_Count
FROM Activity
WHERE Browser IS NOT NULL
AND Application NOT LIKE '%EO%'
AND Act_Date BETWEEN CONVERT(CHAR(8),DateAdd(d,+1,DateAdd(m,-6,GETDATE())),112) AND CONVERT(CHAR(8),GETDATE(),112)
GROUP BY Browser, Browser_Major_Ver
ORDER BY Usage_Count DESC, Browser, Browser_Major_Ver
Does anyone have any ideas on how to remove duplicates. Something like count only once if -
IP address, Browser and Browser_Full_Ver occur multiple times
Or
User_Id, Browser and Browser_Full_Ver occur mulitple times
Regards Al
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|