In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to delete duplicate records in some key fields of the table in mysql. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Delete Date Server Item SubItem exactly the same, Id must be different, Value may be the same record
For example:
2011-07-27 | mx1.dns.com.cn | SEND_MAIL | TOTAL | 14522 | [delete]
2011-07-27 | mx1.dns.com.cn | SEND_MAIL | TOTAL | 14795 | [reserved]
Implementation process:
Step 1: create a temporary table with exactly the same structure as the Statistic table
Use Statistic
Create table s_tmp as select * from Statistic where 1: 2
Step 2: extract newer data to temporary tables according to Id (automatic growth)
Insert into s_tmp select a.* from Statistic a legendary b where a.Date=b.Date and a.Server=b.Server and a.Key=b.Key and a.SubKey=b.SubKey and a.id > b.id
Step 3: delete the data of the corresponding date of the original table according to the date information of the data in the temporary table
Delete from Statistic where Date in (select distinct Date from s_tmp)
Step 4: import the data from the temporary table into Statistic
Insert into Statistic select * from s_tmp
Step 5: finally empty the temporary table
Delete * from s_tmp
On how to delete some key fields of the table in mysql, repeat records are shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.