ホームページ >データベース >mysql チュートリアル >重複データを削除するMysqlメソッド
この記事では主にMysql削除重複データMysqlデータの重複排除を紹介します。必要な友達は参照してください
MySQLデータベース中クエリ重複データ
select * from employee group by emp_name having count (*)>1;
Mysqlクエリを削除できます重複データ
select t1.* from employee t1 where (t1.emp_name) in (select t4.emp_name from (select t2.emp_name from employee t2 group by t2.emp_name having count(*)>1) t4) and t1.emp_id not in (select t5.emp_id from (select min(t3.emp_id) as emp_id from employee t3 group by t3.emp_name having count(*)>1) t5);
Mysql 重複データを削除
delete t1 from employee t1 where (t1.emp_name) in (select t4.emp_name from (select t2.emp_name from employee t2 group by t2.emp_name having count(*)>1) t4) and t1.emp_id not in (select t5.emp_id from (select min(t3.emp_id) as emp_id from employee t3 group by t3.emp_name having count(*)>1) t5);
以上が重複データを削除するMysqlメソッドの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。