|
 |
|
Dev Articles Community Forums
> Databases
> General SQL Development
|
How to Delete Duplicate Records?
Discuss How to Delete Duplicate Records? in the General SQL Development forum on Dev Articles. How to Delete Duplicate Records? General SQL Development forum to discuss Oracle, PostgreSQL, and platform independent SQL related questions. Learn to utilize the power of SQL to manipulate relational databases.
|
|
 |
|
|
|
|

Dev Articles Community Forums Sponsor:
|
|
|

October 8th, 2002, 10:14 PM
|
|
Junior Member
|
|
Join Date: Aug 2002
Location: Carlsbad, CA
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
How to Delete Duplicate Records?
In a MySQL (3.22.51) file I have three fields
idx (Auto Increment)
filename
pathname
I use an insert command in a dump.sql file to add new records to my file.
INSERT INTO jpeglist (idx, filename, pathname) VALUES ( '', 'c-purpsparkle26w-1.jpg', 'dennisj/20021007');
Sometimes I end up adding the same record twice.
How can I find all duplicate records in Field 'filename' and delete the extra records?
Can I change the INSERT INTO command so new records are added and duplicate records are only updated?
TIA
Dennis
|

October 9th, 2002, 03:56 AM
|
|
weirdomoderator
|
|
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370
Time spent in forums: < 1 sec
Reputation Power: 11
|
|
|
__________________
Best Regards,
Håvard Lindset
|

October 31st, 2002, 06:10 AM
|
|
Junior Member
|
|
Join Date: May 2002
Location: Alkmaar, Netherlands
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
SELECT *, count(*) cnt FROM tableName GROUP BY fieldname1, fieldname2, .... HAVING cnt > 1
This will return all the records in the tableName more than 1 time. Include all the fields except the auto increment field in GROUP BY part.
Rest is trivial
|

January 7th, 2003, 01:46 PM
|
|
Junior Member
|
|
Join Date: Jun 2002
Location: New Zealand
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Why not use a unique index on the table?
That way when it comes to actually inserting the record:
"INSERT INTO jpeglist (idx, filename, pathname) VALUES ( '', 'c-purpsparkle26w-1.jpg', 'dennisj/20021007');"
it will complain about this being a duplicate record and will not insert a new record. This will elliminate duplicate files without actually having to build any code for it?
Thanx
Clive
|

June 6th, 2005, 02:00 AM
|
|
Registered User
|
|
Join Date: Dec 2004
Posts: 2
Time spent in forums: 9 m 46 sec
Reputation Power: 0
|
|
|
Every man has different problems vith files. I know how to solve the problem with duplicate files. I use Duplicate checker PRO 6.0 for such purposes (http://www.atory.com/Dupe_Checker_PRO/). I suggest you to try it if you experience "dupe-problem"...
Good luck!
|

June 14th, 2005, 07:12 PM
|
|
My beat is correct.
|
|
Join Date: Dec 2004
Posts: 339

Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 9
|
|
|
You've exhumed a long-dead thread to pimp an irrelevant product (the problem is duplicate records in a database, not duplicate files).
Please don't do that.
__________________
"A pawn is the most important piece on the chessboard -- to a pawn"
|

August 9th, 2006, 08:23 AM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 3
Time spent in forums: 6 m 31 sec
Reputation Power: 0
|
|
Find and delete duplicate files and folders by Dupe Checker PRO 
|

August 9th, 2006, 08:47 AM
|
 |
I'm Internet Famous
|
|
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886
 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 13
|
|
|
Deja vu.
|

December 13th, 2010, 12:21 PM
|
|
Registered User
|
|
Join Date: Dec 2010
Posts: 1
Time spent in forums: 10 m 26 sec
Reputation Power: 0
|
|
|
I ran into a problem of duplicate files and someone told me about duplicates-finder.com
|

December 21st, 2010, 06:16 AM
|
|
Registered User
|
|
Join Date: Dec 2010
Posts: 1
Time spent in forums: 2 m 32 sec
Reputation Power: 0
|
|
|
Delete Long Path File
Hi. I ran into that problem too. And after days of searching I finally found this software: Delete Long Path File Tool.
It's GREAT. You can find it here:
longpathtool
|

April 22nd, 2011, 04:59 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 5
Time spent in forums: 30 m 43 sec
Reputation Power: 0
|
|
|
Delete from table_name A
where rowid > (select min(rowid) from table_name B where B.keyword = A.keyword)
|

November 5th, 2012, 11:25 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 6 m 6 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by dennisj In a MySQL (3.22.51) file I have three fields
idx (Auto Increment)
filename
pathname
I use an insert command in a dump.sql file to add new records to my file.
INSERT INTO jpeglist (idx, filename, pathname) VALUES ( '', 'c-purpsparkle26w-1.jpg', 'dennisj/20021007');
Sometimes I end up adding the same record twice.
How can I find all duplicate records in Field 'filename' and delete the extra records?
Can I change the INSERT INTO command so new records are added and duplicate records are only updated?
TIA
Dennis |
So you are looking for a application that delete values from database but for that purpose i think sql is fair enough to delete duplicate values and there are various constraints available in SQL that may help not to enter duplicate values in database.
|

January 7th, 2013, 07:11 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 6
Time spent in forums: 13 m 15 sec
Reputation Power: 0
|
|
|

January 12th, 2013, 04:06 AM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 6 m 53 sec
Reputation Power: 0
|
|
|
I use the program from DuplicateFilesDeleter.com to find and delete duplicates. You may try. Thanks
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|