Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-25 : 08:21:06
|
| Gant writes "Hello,I have a database table that is populated with my user's hits. Every time a section of my page is viewed, the hit information is stored into the hit table. My hit table stores the following information:IDkey, Particular Page Visited, Time, IP, Referer and lastly their NT login. This data is very useful, and I use SQL to make my statistics report. What I'd like to do is have a SQL query that will return the top 5 most visited pages. That is, I'd like it to go through the second column (Page) and count how many instances exist of each name, and then simply return the top 5.Thank you for your time,Gant" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-06-25 : 08:47:22
|
Without your exact ddl I am unable to give you exact sql, but it will be something like...select top 5 [Particular Page Visited], count(*) as Visitsfrom sometablegroup by [Particular Page Visited]order by count(*) desc <O> |
 |
|
|
|
|
|