sql - Removing Duplicate Rows From MySQL Table -
so, have mysql database setup:
+--------------------+----------+ | email | password | +--------------------+----------+ | example@gmail.com | xxx | | example2@yahoo.com | xxx | | example@gmail.com | xxx | +--------------------+----------+
i want delete duplicate row(s) email , password same.
any ideas on how this?
while have populated table , gordon's answer amble current situation , possibly fastest solution, prevent entering duplicates in future should:
create unique (composite) index on column(s) wish unique. in case sql like:
alter table yourtablename add unique index idx_unq(`email`,`password`);
then insert ignore into
instead of insert into
. ignore duplicate future entries populating in table.
this post may you.
"insert .. on duplicate key update" inserts new entries rather replace?
Comments
Post a Comment