开发者

SELECT DISTINCT the data is distinct but not being filtered [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

Trying 开发者_如何学编程to track AdWords visits cause lots of click fraud.

Problem is log is overzealous so often times it will record 2 visits for 1. This is noticable to the eye since the two time's and ip's are identical. Just having trouble translating it to SQL.

This is returning 2+ clicks for when the IP matches and the time matches.

SELECT DISTINCT wmf24_statpress.time, count(ip) AS clicks, ip 
FROM wmf24_statpress
WHERE urlrequested LIKE  '%gclid=%'  
GROUP BY ip


Just add time to your GROUP BY clause and you should be fine:

SELECT `time`, count(ip) AS clicks, ip 
FROM wmf24_statpress
WHERE urlrequested LIKE  '%gclid=%'  
GROUP BY `time`, ip

Also, you don't need the distinct clause


Group by both time and ip to remove duplicates and still see repeats, i.e.

SELECT wmf24_statpress.time, count(ip) AS clicks, ip 
FROM wmf24_statpress
WHERE urlrequested LIKE  '%gclid=%'  
GROUP BY wmf24_statpress.time, ip
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜