1,修改1列
| 
 1 
2 
3 
 | 
update student s, city c set s.city_name = c.namewhere s.city_code = c.code; | 
2,修改多个列
| 
 1 
2 
3 
 | 
update a, b set a.title=b.title, a.name=b.namewhere a.id=b.id | 
?子查询
| 
 1 
 | 
update student s set city_name = (select name from city where code = s.city_code); | 
oracle查询报这个错误:single-row subquery returns more than one row怎么解决?
数据库按照你的条件查询有多个重复的数据。
例如:
| 
 1 
2 
3 
4 
5 
6 
7 
8 
 | 
UPDATE "SYS_ROLE" A SET A ."DEPT_ID" = (   SELECT    c."id"  FROM    "his_department_info" c   WHERE    c."dept_name" = A ."ROLE_NAME" | 
如果以上sql语句报single-row subquery returns more than one row的错误,说明 c表”dept_name” 和A 表.”ROLE_NAME” 的这两个字段 数据重复
总结
以上所述是小编给大家介绍的如何使用MySQL一个表中的字段更新另一个表中字段,希望对大家有所帮助