当前位置:网站首页>SQL: query duplicate data and delete duplicate data
SQL: query duplicate data and delete duplicate data
2022-04-23 20:24:00 【First code】
1. Single column
select * from test
where name in (select name from test group by name having count
(name) > 1
select * from [ Department information summary ]
where Effective or not = 1 and [ Department name ] in (select [ Department name ] from [ Department information summary ] where Effective or not =1 group by [ Department name ] having count
([ Department name ]) > 1)
and Where in (select Where from[ Department information summary ] group by Where having count
( Where ) > 1)
2 Multiple columns
SELECT a.* FROM test a,(
SELECT name,code
FROM test
GROUP BY name,code
HAVING COUNT(1)>1
) AS b
WHERE a.name=b.name AND a.code=b.code
3 Delete duplicate data
Take deleting duplicate ID cards as an example
delete from Test
where ID number in( select ID number from Test group by ID number having count( ID number ) > 1) and
TK not in(select max(TK) from Test group by ID number having count( ID number ) > 1 )
Query duplicate ID card
select ID number ,count(*) from Test group by ID number having count(*) > 1
版权声明
本文为[First code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551267930.html
边栏推荐
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
- The R language uses the timeroc package to calculate the multi time AUC value of survival data without competitive risk, and uses the confint function to calculate the confidence interval value of mul
- Identification of bolt points in aerial photography based on perception
- Experience of mathematical modeling in 18 year research competition
- Development of Matlab GUI bridge auxiliary Designer (functional introduction)
- Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
- Servlet learning notes
- Solution to PowerDesigner's failure to connect to MySQL in x64 system
- ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
- 波场DAO新物种下场,USDD如何破局稳定币市场?
猜你喜欢
[graph theory brush question-4] force deduction 778 Swimming in a rising pool
PCL点云处理之计算两平面交线(五十一)
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
The ODB model calculates the data and outputs it to excel
[PTA] get rid of singles
DTMF双音多频信号仿真演示系统
A useless confession artifact
LeetCode 74、搜索二维矩阵
Scrapy教程 - (2)寫一個簡單爬蟲
Numpy - creation of data type and array
随机推荐
After route link navigation, the sub page does not display the navigation style problem
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
Browser - learning notes
Mysql database backup scheme
A useless confession artifact
star
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
Tencent Qiu Dongyang: techniques and ways of accelerating deep model reasoning
ArcGIS js api 4. X submergence analysis and water submergence analysis
Recognition of high-speed road signs by Matlab using alexnet
Modeling based on catiav6
Zdns was invited to attend the annual conference of Tencent cloud basic resources and share the 2020 domain name industry development report
. Ren -- the intimate artifact in the field of vertical Recruitment!
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
Servlet learning notes
Experience of mathematical modeling in 18 year research competition
Commit and rollback in DCL of 16 MySQL
An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
How can matlab obtain the truncated image in trainingimagelabeler