Article Directory
Update basic usage
UPDATE table_name
SET column1=value1,
column2=value2,
...
WHERE some_column = some_value;
Important: If the where condition is not added, all data in the table is updated
Combination of Update and Select
Usage template:
UPDATE T1
[INNER JOIN | LEFT JOIN] T2 ON T1.C1 = T2. C1
SET T1.C2 = T2.C2,
T2.C3 = expr
WHERE condition
Example:
UPDATE sys_user_copy sc
INNER JOIN jianshe js ON sc.nick_name = js.`姓名`
AND sc.phonenumber = js.`手机号`
SET sc.user_sys = js.`登录名`
WHERE
sc.user_sys is null