Forum Moderators: open

Message Too Old, No Replies

group page ids into a "top 20" list

         

musicales

3:04 pm on Jan 18, 2006 (gmt 0)

10+ Year Member



I have a table that has a list of pagesids and sessions, so if a user hits a page it stores both the pageid and their session.

I now want to group all the pageids from all sessions and list in order of popularity

I'm using sql2000

In pseudo code it's select count(select distinct pageid)) or something like that.

Just to clarify, the table looks something like this:
page_id session_id rdate
2537 812519356 1/18/2006 8:00:14 AM
7063 812524306 1/18/2006 8:22:07 AM
7063 812527295 1/18/2006 8:42:33 AM

Any ideas?

mattglet

6:02 pm on Jan 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SELECT page_id, COUNT(1) as visitCount FROM yourTable GROUP BY page_id ORDER BY visitCount DESC

musicales

7:05 pm on Jan 18, 2006 (gmt 0)

10+ Year Member



wow! just test that and it worked. Thanks a lot.