commit 6ccdfb5e7832779d67d6cb702f6ffded0f5e602b parent 2588c5cb897fe2a2cdbc72beb9a32d757bae9c55 Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Wed, 12 Apr 2023 17:42:31 -0500 Find each duplicate email in the list Diffstat:
| A | duplicate-emails/duplicate-emails.sql | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/duplicate-emails/duplicate-emails.sql b/duplicate-emails/duplicate-emails.sql @@ -0,0 +1,9 @@ +--This joins the table with itself where the id of a person is not the same but the email is. +--By doing this you get every time that an email is reused. Then using the distinct keyword it +--does not show duplicates of every email +--Time: 757ms Beats: 40.17% +SELECT DISTINCT p1.Email +FROM Person AS p1 +INNER JOIN Person AS p2 +ON p1.Email = p2.Email +WHERE p1.id != p2.id