mysql - Deleting duplicate rows from a table -


I have a table in my database that has duplicate records that I want to delete. I do not want to create a new table with specific entries for it. What I need is to remove duplicate entries from the existing table without any new table formation. Is there any way to do this?

  id action L1_name L1_data L2_name L2_data L3_name L3_data L4_name L4_data L5_name L5_data L6_name L6_data L7_name L7_data L8_name L8_data L9_name L9_data L10_name L10_data L11_name L11_data L12_name L12_data L13_name L13_data L14_name L14_data L15_name is L15_data  

All of these are my fields:
ID is unique to every line.
The L11_data is unique to the corresponding action field.
L11_data is going to be the name of the company while action industries have been named.

So in my data, I keep duplicate names for companies in my L1_data for their respective industries.

What do I want that companies should have unique names and other data in a specialized industry stored in action. I hope I have explained my problem in the way that you guys can understand.

Yes, there is a unique ID field, you can delete all records which are the same except for the ID , But there is no "minimum ID" for your group values.

Example query:

  Remove from table that does not have table ID (SELECT MIN (ID) from table group by field 1, field 2, field 3)  

Note:

  • I have chosen the name "table" and "id" as a representative name for free
  • List of fields It should be a slow query based on the number of fields and rows (though "field 1, field 2, ...") id
  • Do Mmid that option it will recover over

Edit: If you do not have a unique index, my recommendation is to add an auto-incremental unique index. Mainly because it is a good design, but it will also allow you to run the following question.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -