Reputation: 313
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 number of times that unique referrer shows up in the column.
Upvotes: 2
Views: 339
Reputation: 2409
SELECT referrer, COUNT(referrer) FROM table_name GROUP BY referrer;
Upvotes: 0
Reputation: 2460
select referrer, count(*) as NumberOfHits
from yourTable
group by referrer
Upvotes: 7