国产探花免费观看_亚洲丰满少妇自慰呻吟_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去重留一
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 万全县| 庆元县| 安图县| 盐城市| 扶沟县| 奉新县| 博白县| 新泰市| 朝阳县| 连州市| 洪洞县| 新泰市| 德州市| 宣城市| 辽宁省| 恩平市| 屏南县| 宣汉县| 高唐县| 昌吉市| 陕西省| 濮阳县| 龙井市| 汾阳市| 祁阳县| 齐齐哈尔市| 乌拉特中旗| 龙州县| 历史| 龙海市| 龙陵县| 娱乐| 敖汉旗| 逊克县| 浦东新区| 宣城市| 鄂州市| 凌源市| 民权县| 永靖县| 桦川县|