database - MySQL v5.7.4 - Is there no longer a way to remove duplicates with "unique index"? -


so apparently after mysql v5.7.4, keyword ignore no longer supported, nukes useful duplicate-removing query:

alter ignore table labs  add unique index nodupes (ruid, test_sname, test_value, units, ref_range, entry_date); 

everywhere i've looked notes discontinued support of ignore, doesn't suggest replacement.

is there still simple way utilize power of unique index remove duplicates without using ignore after mysql v5.7.4?

many people consider thing creating index not delete records underlying table. 1 method use temporary table, truncate, , insert:

create temporary table tokeep      select distinct ruid, test_sname, test_value, units, ref_range, entry_date      labs;  truncate table labs;  insert labs(ruid, test_sname, test_value, units, ref_range, entry_date)     select ruid, test_sname, test_value, units, ref_range, entry_date     tokeep; 

note: version assumes these columns in table. if there other columns, similar logic work.


Popular posts from this blog

Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -