国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

Mysql刪除重復的數據 Mysql數據去重復

2024-07-24 13:10:22
字體:
來源:轉載
供稿:網友

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教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汽车| 三门县| 潜山县| 宁乡县| 特克斯县| 思茅市| 桑植县| 大厂| 德清县| 潼关县| 广宗县| 海丰县| 筠连县| 琼海市| 峡江县| 萝北县| 河东区| 洛隆县| 凤山县| 通州市| 麻栗坡县| 花莲市| 华宁县| 芮城县| 长宁县| 洛川县| 皋兰县| 伊春市| 惠安县| 朝阳市| 田东县| 兰西县| 西吉县| 巧家县| 邵武市| 云阳县| 昌吉市| 彩票| 阳城县| 和龙市| 广德县|