![]() |
|
Porsche, and the Porsche crest are registered trademarks of Dr. Ing. h.c. F. Porsche AG.
This site is not affiliated with Porsche in any way. Its only purpose is to provide an online forum for car enthusiasts. All other trademarks are property of their respective owners. |
|
![]() |
SirAndy |
![]() ![]()
Post
#1
|
Resident German ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 42,245 Joined: 21-January 03 From: Oakland, Kalifornia Member No.: 179 Region Association: Northern California ![]() |
SQL Question:
what's the easiest way to find duplicates in a table? let's say i have a table (tbl_Users) with 20000 rows and the table has a column for the users email addy (sEmail) and i want to list all the accounts that have duplicate email addys. i could run a script that takes each row and runs a count(*) on that addy, but that'll take forever. anything simpler than that ??? (IMG:http://www.914world.com/bbs2/html/emoticons/idea.gif) Andy |
![]() ![]() |
john rogers |
![]()
Post
#2
|
Senior Member ![]() ![]() ![]() Group: Members Posts: 1,525 Joined: 4-March 03 From: Chula Vista CA Member No.: 391 ![]() |
Do it like this:
sqlplus> delete from userID.my_email_data a where rowid < (select max(rowid) from userID.my_email_data b where b.address = a.address and b.username = a.username); Notes: userID is the schema owner, my_email_data is the name of the table and address, username are the fields to check for dupes to. You can not use any functions such as substr(....) or you'll get inconsistant results. Additionally, the email field entries have to be exacly alike, even to case or it will fail cause then they aren't really duplicates! |
![]() ![]() |
![]() |
Lo-Fi Version | Time is now: 5th July 2025 - 10:27 AM |
All rights reserved 914World.com © since 2002 |
914World.com is the fastest growing online 914 community! We have it all, classifieds, events, forums, vendors, parts, autocross, racing, technical articles, events calendar, newsletter, restoration, gallery, archives, history and more for your Porsche 914 ... |