Solved

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

Posted on 2011-03-05
3
377 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now