当前位置:网站首页>SQL filter query duplicate columns
SQL filter query duplicate columns
2020-11-09 22:26:00 【Game life】
id_cardxx by table;id,id_card,phone Are fields
-- Show repeating Columns select * from Table name where Name in (select Name from Table name group by Name having COUNT(*)>1) order by Name
select * from file_selection where mash in (select mash from file_selection group by mash having COUNT(*)>1) order by mash
-- Query duplicate data but exclude Minimum id MIN( id )
SELECT *
FROM
id_cardxx c
WHERE
EXISTS (
SELECT
a.id
FROM
id_cardxx a,
( SELECT id_card, MIN( id ) AS rid FROM id_cardxx GROUP BY id_card HAVING count( 1 ) > 1 ) b
WHERE
a.id_card = b.id_card
AND a.id != b.rid
AND c.id = a.id
)
AND id > 8071
AND phone IS NULL
ORDER BY
c.id_card;
-- To modify, you need to query the data as a new table once And
UPDATE id_cardxx
set Modify fields = 'xxxx'
WHERE id in ( SELECT....end ) as xx1
-- complete sql
UPDATE id_cardxx
set source = 'xxxx'
WHERE id in (
SELECT xx1.id FROM
(
SELECT id
FROM
id_cardxx c
WHERE
EXISTS (
SELECT
a.id
FROM
id_cardxx a,
( SELECT id_card, MIN( id ) AS rid FROM id_cardxx GROUP BY id_card HAVING count( 1 ) > 1 ) b
WHERE
a.id_card = b.id_card
AND a.id != b.rid
AND c.id = a.id
)
AND id > 8071
AND phone IS NULL
) as xx1
)
版权声明
本文为[Game life]所创,转载请带上原文链接,感谢
边栏推荐
- 探访2020 PG技术大会
- [best practice] learn how eolinker helps Telecommuting
- ES6, ES7, es8 Learning Guide
- Unemployment after graduation? How do college students allocate their study time and have a complete computer knowledge system?
- How to implement LRU algorithm
- Important components of Apache Hadoop
- PHP - curl copy paste access SMS verification code example
- 报错 Type interface *** is not known to the MapperRegistry. 的解决方案
- PL/SQL Developer临时用户和新手的功能指南
- Operation! Nested JSON second change dataframe!
猜你喜欢

Configure the NZ date picker time selection component of ng zerro

Configure the NZ date picker time selection component of ng zerro

CRM系统能帮助企业做哪些事?

磁阻式随机存储器MRAM基本原理

Quick for imx6ull development board c program call shell

手把手教你使用容器服务 TKE 集群审计排查问题

【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
![[best practice] learn how eolinker helps Telecommuting](/img/3b/00bc81122d330c9d59909994e61027.jpg)
[best practice] learn how eolinker helps Telecommuting

修改jar包里的文件

JT-day10
随机推荐
Performance evaluation report of YoMo codec - Y3
LeetCode 50 Pow(x,n)
AQS source code in-depth analysis of conditional queue
Postman (1) -- function introduction
day84:luffy:优惠活动策略&用户认证&购物车商品的勾选/结算
面试官:缓存穿透、缓存雪崩和缓存击穿是什么?
如何高效进行模幂运算
Daily page number style problems
ES6, ES7, es8 Learning Guide
input 与 button 的问题 (空隙/不等高/对不齐)及 解决办法
60 余位技术高管齐聚松山湖,华为云第一期核心伙伴开发者训练营圆满落幕
From master of Engineering Physics of Tsinghua University to open source entrepreneur of cloud computing
What is the architecture of a live broadcast system worth more than $1 billion?
LeetCode-378. 有序矩阵中第K小的元素
价值超10亿美元的直播系统架构图是什么样子的?
Another comparison operator related interview question let me understand that the foundation is very important
【涂鸦物联网足迹】涂鸦云平台接口说明
害怕重构?都怪我太晚和你介绍该如何重构,现在我来了
修改jar包里的文件
Just graduated will be confused, I after 7 years of summary, give programmers your 7 suggestions