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

首頁 > 數據庫 > MySQL > 正文

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

2024-07-24 12:53:46
字體:
來源:轉載
供稿:網友

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去重的方法整理mysql去重的兩種方法詳解及實例代碼mysql 開發技巧之JOIN 更新和數據查重/去重一條sql語句完成MySQL去重留一
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 株洲市| 白河县| 漳州市| 台东县| 邮箱| 英吉沙县| 噶尔县| 汽车| 巴里| 体育| 洪泽县| 疏勒县| 金平| 石泉县| 梅州市| 中方县| 濮阳市| 嘉定区| 讷河市| 白朗县| 灌云县| 永春县| 建水县| 霞浦县| 偃师市| 永寿县| 康平县| 洪江市| 仁化县| 黔江区| 镇远县| 大邑县| 磐安县| 华安县| 英吉沙县| 扶绥县| 吉木乃县| 万荣县| 元阳县| 曲周县| 中阳县|