当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Gets the property value of a column in the list collection object
- More than 60 technical executives gathered in Songshan Lake, and the first phase of Huawei cloud core partner developer training camp was successfully concluded
- 如何k个一组反转链表
- Traditional purchasing mode has changed! How to innovate automobile purchasing function?
- Configure ng
- 2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
- 日常页码样式问题
- Important components of Apache Hadoop
- Configure the NZ date picker time selection component of ng zerro
- Leetcode 49 letter heterotopic word grouping
猜你喜欢

Configure the NZ date picker time selection component of ng zerro

Performance evaluation report of YoMo codec - Y3

PL/SQL Developer临时用户和新手的功能指南

商品后台系统实现

价值超10亿美元的直播系统架构图是什么样子的?

How to implement LRU algorithm

Postman (1) -- function introduction

How SSL certificate and public IP address affect SEO

如何k个一组反转链表

The basic principle of MRAM
随机推荐
JT Jingtao project
How SSL certificate and public IP address affect SEO
害怕重构?都怪我太晚和你介绍该如何重构,现在我来了
sql 截取数据中 ‘.’的前后数据
ES6, ES7, es8 Learning Guide
Expect ':' at 0, actual = (JSON conversion exception resolution)
Configure the NZ date picker time selection component of ng zerro
PHP - cURL复制粘贴性接入短信验证码示例
The basic principle of MRAM
Operation and design of rights management in ERP
【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
[best practice] learn how eolinker helps Telecommuting
11.9
正式班D25
手把手教你使用容器服务 TKE 集群审计排查问题
Dongge ate grapes when he ate an algorithm problem!
Can public IP address and SSL certificate improve SEO?
没有磁盘空间 No space left on device
Brief analysis of LinkedList source code