Mysql刪除重復(fù)的數(shù)據(jù)的方法
發(fā)表時間:2023-08-24 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]這篇文章主要介紹了Mysql刪除重復(fù)的數(shù)據(jù) Mysql數(shù)據(jù)去重復(fù),需要的朋友可以參考下MySQL數(shù)據(jù)庫中查詢重復(fù)數(shù)據(jù)select * from employee group by emp_name having count (*)>1;Mysql 查詢可以刪除的重復(fù)數(shù)據(jù)select t1....
這篇文章主要介紹了
Mysql刪除重復(fù)的數(shù)據(jù) Mysql數(shù)據(jù)去重復(fù),需要的朋友可以參考下
MySQL數(shù)據(jù)庫中查詢重復(fù)數(shù)據(jù)
select * from employee group by emp_name having count (*)>1;
Mysql 查詢可以刪除的重復(fù)數(shù)據(jù)
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 刪除重復(fù)的數(shù)據(jù)
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刪除重復(fù)的數(shù)據(jù)的方法的詳細內(nèi)容,更多請關(guān)注php中文網(wǎng)其它相關(guān)文章!
學(xué)習(xí)教程快速掌握從入門到精通的SQL知識。