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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL logic

Status
Not open for further replies.

BigBadDave

Programmer
May 31, 2001
1,069
EU
I am trying to get a handle on selecting the top 10 entry and exit pages of my apache access_log database. I log the url, host name etc. This is what I have for top 10 popular URL's if its any help:

Code:
SELECT `url`, COUNT(`url`) AS `num` FROM `access_log` WHERE `date` = '0000-00-00' GROUP BY `url` ORDER BY `num` DESC LIMIT 0, 10;

If anyone can point me in the right direction I'd appreciate it. :)

Regards
David Byng
bd_logo.gif

davidbyng@hotmail.com
 
if you could explain which rows represent entry pages and which rows represent exit pages, you would just modify the query you have, except change the WHERE condition

rudy
SQL Consulting
 
It's not that simple unfortunately, this is what I have but I don't think its accurate:

Code:
CREATE TEMPORARY TABLE `tmp` SELECT `url`, COUNT(DISTINCT `host name`) AS `num` FROM `access_log` WHERE `date` = '0000-00-00' GROUP BY `host name` ORDER BY `num` DESC;
SELECT `url`, SUM(`num`) AS `num` FROM `tmp` GROUP BY `url` ORDER BY `num` DESC LIMIT 0, 10;

Regards
David Byng
bd_logo.gif

davidbyng@hotmail.com
 
That's what I need to do, I assume I can do it by selecting the time field and seeing the last request by host name within a 20 minute period for example but I'm not sure.

Regards
David Byng
bd_logo.gif

davidbyng@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top