Finding duplicate rows SQL
I needed to find all the users with duplicated phone numbers in the phone_number table (same phones have the same number and same country_id):
SELECT user_id, number, COUNT(*) FROM phone_numbers GROUP BY user_id, country_id, number HAVING COUNT(*) < 1;

Comments [1]