Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-06-2004, 02:51 AM   #1
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Any mySQL experts around?

I have this mySQL query that displays raw page visits.

SELECT DISTINCT page_visited, COUNT(page_visited) FROM clubd_counter_data GROUP BY page_visited ORDER BY page_visited

The table has a field called surfer_ip that holds the ip of the surfer that visited a page.

Now what I want to do is display unique ip vists per page. What do I need to add to the above SQL query to get that? I want the count to be unique page visits instead of all page visits.

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:00 AM   #2
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
SELECT COUNT(DISTINCT surfer_ip) FROM clubd_counter_data WHERE table_that_holds_the_page LIKE 'index.hml'

Change "table_that_holds_the_page" to the correct table name that has the page name and "index.html" to the page you want to count unique IP's on.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:06 AM   #3
rickholio
Confirmed User
 
Industry Role:
Join Date: Jan 2004
Location: Nor'easterland
Posts: 1,914
select count(distinct surfer_ip), page_visited from clubd_counter_data group by page_visited

Should aughta do the trick.
rickholio is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:10 AM   #4
rickholio
Confirmed User
 
Industry Role:
Join Date: Jan 2004
Location: Nor'easterland
Posts: 1,914
BTW - In your original query:

SELECT DISTINCT page_visited, COUNT(page_visited) FROM clubd_counter_data GROUP BY page_visited ORDER BY page_visited

You don't need the 'DISTINCT' keyword for page_visited, as it'll be made effectively distinct in GROUP BY. I suspect mysql would probably just optimize that away however.

HTH. HND.
rickholio is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:29 AM   #5
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Quote:
Originally posted by rickholio
select count(distinct surfer_ip), page_visited from clubd_counter_data group by page_visited

Should aughta do the trick.
Thanks! This one looks like it returned what I want.

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:30 AM   #6
Danielle
Confirmed User
 
Danielle's Avatar
 
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
Quote:
Originally posted by rickholio
BTW - In your original query:

SELECT DISTINCT page_visited, COUNT(page_visited) FROM clubd_counter_data GROUP BY page_visited ORDER BY page_visited

You don't need the 'DISTINCT' keyword for page_visited, as it'll be made effectively distinct in GROUP BY. I suspect mysql would probably just optimize that away however.

HTH. HND.
Thank you. I am just starting to learn mySQL. I did not know that.

Hugs,
Danielle
Danielle is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2004, 03:43 AM   #7
rickholio
Confirmed User
 
Industry Role:
Join Date: Jan 2004
Location: Nor'easterland
Posts: 1,914
No problem. SQL's pretty easy to do once you get the hang of it... the trick of it is just learning how to organize your data and their relationships so you don't bring your server to its knees when checking on some random statistic. ;)

Gimmie a poke at ICQ:4435025 if you need any more help. Except not for a week after this monday... my sql'ing has bought me a trip to jamaica.
rickholio is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.