The table was previously updated with SQL Server, UPDATE statement:
Update a set a.xx= (select yy from B); Yes, I can.
However, in MySQL, you cannot directly use the result of the set Select,
UPDATE ecs_users_copy
SET ' user_name ' = (
SELECT
' Identity_card '
From
Ecs_users_copy
WHERE
LENGTH (identity_card) = 18
and LENGTH (user_name)! = 18
)
This is the wrong way!
You must use INNER join:
Demo1
Update a INNER JOIN (select table from B) C set a.id = a.id where a xxx
Demo2
UPDATE Ecs_users_copy as a
INNER JOIN (SELECT ' identity_card ', ' user_name ' from ecs_users_copy) b
SET A.user_name = A.identity_card
WHERE
a.user_id =a.user_id and (LENGTH (a.identity_card) = 18
and LENGTH (a.user_name)! = 18)
The more things you use, the easier it is to confuse ~ ~
Write for one weeks Java, and then write back to PHP
\exception E
, suddenly found out why not, the original PHP exception is a $ ~ ~ ~ and Java did not ~ ~ ~
MySQL Update select usage