Home > database >  MySQL false delete duplicate data, only keep a data?
MySQL false delete duplicate data, only keep a data?

Time:09-26

Query the article have duplicate data of a certain data and preserved; Other do false,

Code:


Use this approach error:
Error code: 1093
You can 't specify target table' I 'for update in the FROM clause

How to solve this problem? Is there any other solutions?

CodePudding user response:

In https://blog.csdn.net/z_youarethebest/article/details/53785487, You can refer to this solution, mysql You can 't specify target table for update in the FROM clause error mean, first to select the certain values in the same table, and then update the table (in the same statement),

CodePudding user response:

 delete s1. * from students s1, student where s1, s2 ` name `=s2. ` name ` and s1. Id> S2. Id 

CodePudding user response:

The above SQL looks, very beautiful ~ ~ ~
mark
  • Related