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)文章
MySQL 啟動報錯:File ./mysql-bin.index not found (Errcode: 13)
這篇文章主要介紹了MySQL 啟動報錯:File ./mysql-bin.index not found (Errcode: 13)的解決方法,需要的朋友可以參考下2014-07-07
安裝配置mysql及Navicat prenium的詳細流程
這篇文章主要介紹了安裝配置mysql及Navicat Premium的詳細流程,配置方法也真的很簡單,本文給大家詳細介紹mysql Navicat Premium安裝配置相關(guān)知識感興趣的朋友,一起學習吧2021-06-06
MySql中流程控制函數(shù)/統(tǒng)計函數(shù)/分組查詢用法解析
這篇文章主要介紹了MySql中流程控制函數(shù)/統(tǒng)計函數(shù)/分組查詢用法解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-07-07

