《Mysql實例Mysql刪除重復的數據 Mysql數據去重復》要點:
本文介紹了Mysql實例Mysql刪除重復的數據 Mysql數據去重復,希望對您有用。如果有疑問,可以聯系我們。
MySQL數據庫中查詢重復數據MYSQL入門
select * from employee group by emp_name having count (*)>1;MYSQL入門
Mysql? 查詢可以刪除的重復數據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入門
Mysql? 刪除重復的數據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入門
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/5934.html