Created
February 23, 2023 08:46
-
-
Save space11/064cab14816613fe4e8b0d339d8fa1f0 to your computer and use it in GitHub Desktop.
Find users with the same email address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Find users ID that have the same email address | |
| SELECT u.id FROM `user` AS u | |
| INNER JOIN | |
| ( | |
| SELECT email FROM `user` | |
| GROUP BY `user`.email HAVING count(id) > 1 | |
| ) AS u2 ON u2.email = u.email; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment