Delete duplicate records in MySQL database

1086940 pts.
Tags:
Database
MySQL
SQL Server
One of our clients asked us to delete duplicate records in a SQL Server database and a MySQL database. We did it in SQL but MySQL is giving us issues. It says the format of the query is not correct. Does anyone know of a way to do this? Thank you so much!D

Answer Wiki

Thanks. We'll let you know when a new response is added.

Thanks for coming to ITKE

I did a web search on your question and found may sites that would assist you. here is a link to one of them. http://www.tutorialspoint.com/mysql/mysql-handling-duplicates.htm

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    What does your code look like for the MySQL?
    109,950 pointsBadges:
    report
  • GeoffD

    Hi,

    MySQL is a bit different in terms of the syntax but most things are the same.

    We encountered problems structuring queries when we had a MYSQL linked Server.

    In MSSQL you would reference your table in a query as [Linked Server Name].[Database name].[Schema name].[Tablename]

    However with MYSQL it's referenced like this: [Linked Server Name]...[Tablename] and you must have the three periods in between.

    Hope this Helps

    85 pointsBadges:
    report
  • bhanu4444
    Good information...
    10 pointsBadges:
    report
  • compex11
    Follow these steps.
    1. place the table u wish to clean in sequence by the info that identifies the duplicate. be sure that the record u wish to retain is the first in the sequence of duplicates.
    2. step thru the table by storing the key(the data identifying the duplicate) into variables 
     then stepping to the next record and testing the saved key against the new record key if it matches mark the recordf or deletion and step to the next record; when the key does not match replace the variables stored with the new record info and step to the next record starting the compare step over .
    There are ways to do this with sql that will  improve the speed of the  process for large files but for files of a few million records and an occasional process this is a simple way to identify duplicates.
    60 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: