Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove duplicate fields in mysql table

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article is mainly about how the repeated fields in the mysql table should be removed. If you are interested, let's take a look at this article. I believe it is of some reference value for everyone to read how to remove the repeated fields in the mysql table.

The same data appears multiple times in the same table. My requirement is to delete the excess data, but to keep one of them.

Define the table name table_a, judge the only two fields, centering 1, and irrelevant field data

The original data in the table is as follows

Delete statement:

DELETE FROM table_a WHERE id IN (SELECT id FROM (SELECT id FROM table_a GROUP BY censor 1) HAVING count (*) > 1) e)

Does the above about how to remove the details of the duplicate fields in the mysql table help you? If you want to know more about it, you can continue to follow our industry information section.

More related content:

The solution of Chinese garbled Code in mysql Table

How to use sql to add columns to a table in mysql database

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report