Illegal websites should not initiate any form of manual service requests to our staff. It is strictly prohibited to use honmau Media's technical support services and products to engage in any illegal activities. If discovered, no technical support will be provided. ×
Current location:home> news > help and support

Operation and maintenance technical services

Response time:10 minutes

How to handle problems:1-on-1 manual technical services

Working hours:Monday to Saturday 8:30-22:00

Business scope:

Website development Mini programs development Discuz operation and maintenance

Baota Operation and Maintenance Website Operation and Maintenance SSL Certificates

Operation and maintenance technology can solve difficult problems for you

search first

recommend

Baota Linux Professional Edition

It includes 13 professional version plug-ins worth more than 3500 yuan, including Web Application Firewall, website monitoring reports and exception monitoring push.

  • Baota system reinforcement
  • Website tamper-proof program
  • Nginx Firewall
  • Website Monitoring Report
advertising

How to delete duplicate data with the same id

existwebsite operation and maintenanceIn, sometimes multiple pieces of data with duplicate ids appear in the database. I want to delete duplicate ids, but I can't find a good solution. This article records and describes based on the actual situation.Please back up the data when operating the database to avoid irreversible operations and causing unexpected losses.

You see multiple deletion methods on the Internet, but the operation will report an error and send it to people who need to solve the problem.

Mysql如何删除id相同的重复数据

Solution:

First check whether there are duplicate data in the table

SELECT id,COUNT(*) FROM table name
GROUP BY id

HAVING COUNT(*) > 1;

Check how much duplicate data there is in total and the statement to delete duplicate data:

Mysql如何删除id相同的重复数据

DELETE FROM 表名 WHERE
id IN (
SELECT id FROM (
SELECT id,COUNT(*) FROM table name
GROUP BY id
HAVING COUNT(*) > 1
) AS a

) Limit number;

limit means the number of items you want to delete. Since the execution speed of delete statements is relatively slow, it is recommended to set a number if there is too much data, such as deleting 1000 or 10000 items first. Otherwise, if the data is too large, mysql execution will crash if it is too slow. If it is rushed to close and then execute, the table will be locked. Unable to operate database.

Table interpretation operation:

1. Check the process, mainly to find the ID of the process whose table is locked

SHOW PROCESSLIST;

2. The process ID of the kill lock table

KILL 10866;//The ID of the immediate process after the number

Content source: Official media/Internet information

Scan mobile WeChat

Continue reading immediately in the Mini programs

© Website copyright and disclaimer

1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;

2. No one is allowed to copy it without the express written permission of [honmau Media];

3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;

4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;

5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice

Recently, do you want to customize and develop a Mini programs/website/hosted operation and maintenance service?
submission
Working days: 8:30 - 22:00  Online QQ customer service

customer service

Company Introduction
top