Solved

Retrieve unique values in a table and rank by number of times they occur

Posted on 2011-03-05
3
407 Views
Last Modified: 2012-05-11
We have a table recording hits on our web site. How could we write a query to retrieve unique IP addresses AND. The number of times each IP address occurs?

Thanks in advance
0
Comment
Question by:nhmedia
3 Comments
 
LVL 13

Accepted Solution

by:
LIONKING earned 250 total points
ID: 35044001
SELECT ip_address, COUNT(*) AS Times_Hit
FROM myHitTable
GROUP BY ip_address
0
 
LVL 7

Assisted Solution

by:mmr159
mmr159 earned 250 total points
ID: 35044010
SELECT ip_address,COUNT(ip_address) AS cnt
FROM table_name
GROUP BY ip_address
0
 

Author Closing Comment

by:nhmedia
ID: 35044052
Thanks, both solutions  worked a treat
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question