: > -----Original Message-----
: > From: John Kelly [mailto:[EMAIL PROTECTED]
: > Sent: Tuesday, October 21, 2003 3:45 PM
: > To: [EMAIL PROTECTED]
: > Cc: [EMAIL PROTECTED]
: > Subject: Re: Need help constructing query ...
: >
: >
: > ----- Original Message ----- 
: > From: "Daniel Clark" <[EMAIL PROTECTED]>
: > To: <[EMAIL PROTECTED]>
: > Cc: <[EMAIL PROTECTED]>
: > Sent: Tuesday, October 21, 2003 2:33 PM
: > Subject: Re: Need help constructing query ...
: >
: >
: > : > Hi, I have a table full of logged urls and ip addresses.
: > The following
: > : > query returns all the urls and the number of requests. How would I
: > : > modify it to return unique requests based on distinct ip
: > addresses?
: > : >
: > : > select url, count(*) as pageviews from table group by url order by
: > : > pageviews desc
: > :
: > : How about:
: > :
: > : SELECT ip_address, url, count(*)
: > : FROM tablename
: > : GROUP BY ip_adress, url
: > :
: > Thanks but I could not get that to work. It does not appear
: > to count the number of page requests by distinct IPs anyway
: > does it? Don't you need something like a
: > count(distinct(ip_address)) somewhere in there?
: >
: > -- 

----- Original Message ----- 
From: "Kevin Fries" <[EMAIL PROTECTED]>
To: "'John Kelly'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, October 21, 2003 3:57 PM
Subject: RE: Need help constructing query ...


: Then I think you want
: SELECT url, COUNT(DISTINCT ip_address)
: FROM tablename
: GROUP BY url;

Thanks, this must be a resource intensive query as it works in a few seconds on
a small table but takes 6+ minutes when done on a table with just 100,000
records. Anyway, thanks again.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to