需求:把 student 表中 name 字段的内容复制到 other_name 字段里面:
sql实现:
UPDATE student SET other_name = name;
结果:
需求:把student表的name字段复制到student_rec表的name字段
student表
student_rec表
sql实现:
UPDATE student_rec INNER JOIN student ON student.id = student_rec.student_id
SET student_rec.`name` = student.`name`
结果: