1、修改1列
update student s, city c
set s.city_name = c.name
where s.city_code = c.code;
2、修改多个列
update a, b
set a.title=b.title, a.name=b.name
where a.id=b.id
•子查询
update student s set city_name = (select name from city where code = s.city_code);
oracle查询报这个错误:single-row subquery returns more than one row怎么解决?
数据库按照你的条件查询有多个重复的数据。
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” 的这两个字段 数据重复。