Reputation: 21749
I have saved all users' IPs in MYSQL. How can I SELECT users who registered with the same IP twice or more?
I know DISTINCT function in MySQL is for selecting unique rows, what about my situation? Are the any functions or I have just to run loop?
Thank you.
Upvotes: 1
Views: 97
Reputation: 12704
SELECT userid, ip
FROM users
GROUP BY userid, ip
HAVING COUNT(userid) > 1;
Upvotes: 1