欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Mysql刪除重復的數(shù)據(jù) Mysql數(shù)據(jù)去重復

 更新時間:2016年08月25日 23:40:30   投稿:mdxy-dxy  
這篇文章主要介紹了Mysql刪除重復的數(shù)據(jù) Mysql數(shù)據(jù)去重復,需要的朋友可以參考下

MySQL數(shù)據(jù)庫中查詢重復數(shù)據(jù)

select * from employee group by emp_name having count (*)>1;

Mysql  查詢可以刪除的重復數(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  刪除重復的數(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);

相關(guān)文章

最新評論