I have a table in 8 columns, but over time I have picked up several duplicates. I have another question with the same topic But it does not solve this issue which I am currently doing.
+ --------------- ------------------------ ---------------------------------------------- + | ID | Market | Agent | Report_name | Manufacturer | Report_date | Enter_date | Sync | + ------------------------------------------------- -------------------------------------- + What defines a unique entry is based on the market, agent, report_name, product_good, and report_adet field. What I see is a way to list all the duplicate entries and delete them. Or just to remove duplicate entries.
I thought about doing it with a script, but there are 2.5 mile entries in the table, and the time it takes will be unusable.
Can anyone recommend any options? I have seen a list of duplicates using the following questions, but it is not sure how to optimize it in my situation:
SELECT id, count (*) AS N & gt; Table_Name being done by Group ID Here are two strategies you can think about. You must adjust the columns used to select duplicates based on the fact that the duplicates were considered. I've included all your listed columns in addition to just the ID column. Creates a new table without the first one duplicates, sometimes it's really fast and easy to delete all the derogatory lines, just create a new table, include the unique rows (I get the resulting line ID Use the minimum (id)), rename the two tables, and (once you're satisfied that everything works correctly) leave the original table, of course, if you have any You'll also need to deal with them when native key obstacles.
Create table table_name such as table_name; Enter in the table (ID, Market, Agent, Report_Name, Manufacturer, Data, Report_date, Submit_date, Sync) Select Minimum (ID), Market, Agent, Report_Name, Manufacturer, Code, Report_date, EntryDate, according to table group from table Group, agent, report_name, constructor code, report_date, enter_date, sync; Rename table_name for table-table, table_opy to table_name; Drop table table_old; The second strategy, which now removes duplicates, uses a temporary table for which there are duplicate lines for information, because MySQL will not allow you to choose from the same table You are removing a subquery from a subquery that creates a floating table with duplicate plus an ID column that actually holds an ID and then you remove a multi-table. Te where you can only join two tables to select the two duplicates.
To create a duplicate temporary table, enter the minimum (ID), market, agent, report_name, product_good, report_date, enter_date, table, group, agent, report_name, product_account, report_date, enter_date,) and Gt ; 1; Removing from Table_name t, DIDS D where t.id! = D.id and t.market = d.market and t.agent = d.agent and t.report_name = d.report_name and t.producer_code = d.producer_code and T.report_date = d.report_date and t.entered_date = d .entered_date and t.sync = d.sync;
Comments
Post a Comment