![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
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. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Quote:
Hugs, Danielle |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Jun 2002
Location: My Coffin
Posts: 1,227
|
Quote:
Hugs, Danielle |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
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. ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |