开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜