Page Hits Calculations

J

JD

Hello Everyone,

I have set up a table that contains the following fields
1. DateAdded
2. PageName


And I am trying to write a query that will pull back records for me where I
can count up the number of times a page or pages were hit on the website for
each day. So if my records were like this

DateAdded PageName
1/1/2006 /index.htm
1/1/2006 /index.htm
1/1/2006 /contact/index.htm
1/2/2006 /index.htm
1/2/2006 /contact/index.htm
1/2/2006 /contact/thankyou.htm

that after query has run I would have something like this
Date Page Number of Visits
1/1/2006 /index.htm 2
1/1/2006 /contact/index.htm 1
1/2/2006 /index.htm 1
1/2/2006 /contact/index.htm 1
1/2/2006 /contact/thankyou.htm 1

I am trying to keep this in sql, but if this this is not possible then I can
always do this in the code on my asp.net page, any help on this would be
appreciated.
 
S

Sylvain Lafontaine

Using a Group By on DateAddedd and PageName and a Count() should give you
what you want; something like:

Select DateAdded, PageName, Count(*) from MyTable Group By DateAdded,
PageName Order by DateAdded ASC, Count(*) DESC, PageName ASC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top