I'm coding an analytics script for my website that tracks traffic sources. When a user visits a page the following info gets recorded in my database: page, referrer, date, ip. I want to list the different referrers in a table along with the num开发者_JAVA技巧ber of times that unique referrer shows up in the column.
select referrer, count(*) as NumberOfHits
from yourTable
group by referrer
SELECT referrer, COUNT(referrer) FROM table_name GROUP BY referrer;
精彩评论