Link to home
Start Free TrialLog in
Avatar of horizzang
horizzang

asked on

SQL, how can I retrieve top 20 hits?

"INSERT INTO statslog (ip,accesstime,thepage,thetype,successCode,thebytes)
      VALUES ('$ip','$access_time','$link[0]','$link[1]','$success_code','$bytes')";

I am doing log anaylsis. I inserted these fields into table.
How can I get TOP 20 Hits URL from thepage field?
How can I get TOP 20 IP addres from ip field?
I am using MySQL..so I can't use select TOP 10...

Thank you for your help.
ASKER CERTIFIED SOLUTION
Avatar of DoppyNL
DoppyNL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zontar
Zontar

SELECT thepage,ip,COUNT(ip) AS ipcount FROM statslog GROUP BY ip ORDER BY ip,thepage DESC LIMIT 20;