国产探花免费观看_亚洲丰满少妇自慰呻吟_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教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 盱眙县| 伊金霍洛旗| 雷山县| 常宁市| 即墨市| 平江县| 济宁市| 开化县| 新龙县| 济源市| 灵山县| 修文县| 昌江| 铅山县| 南涧| 水富县| 来凤县| 瑞昌市| 河东区| 河池市| 商南县| 乐山市| 盘锦市| 肇源县| 措勤县| 松阳县| 阳春市| 泽普县| 龙井市| 金寨县| 兴山县| 修水县| 卓资县| 阿尔山市| 杂多县| 镇远县| 杭州市| 新竹市| 嵊泗县| 兴化市| 漠河县|