Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Distinct (Per day) IP Addresses for a date range

Status
Not open for further replies.

CrystalChris

Technical User
Dec 22, 2011
4
GB
Hi,

I am looking for some help to create a mysql query to get the distinct (per day) count of ip addresses a link has been clicked for a date range.

Lets say my IP address clicks on the same link 5 times every day during January 2012 using the same ip address. There would be 155 (5*31) records in the table but the query result should display 31 as we are only counting the same ip address max of once per day.


Any help would be appreciated
 
Code:
SELECT COUNT(*) AS distinct_count
  FROM ( SELECT DISTINCT
                ip
              , DATE(clickdate)
           FROM daTable
          WHERE clickdate >= '2012-01-01'
            AND clickdate  < '2012-02-01' ) AS t

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top