开发者

How can I count unique records from a column in my MySQL database?

开发者 https://www.devze.com 2023-02-10 19:49 出处:网络
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 diff

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消