如何把读取出来的多条(小于5条)数据update更新,因为是小白。望详细解答,谢谢!或者慕课上有相关教程发个链接也可以,谢谢
6 回答
已采纳
逆光之羽
TA贡献55条经验 获得超13个赞
--建立测试数据表
create table target(
id varchar(32),
value varchar(32)
);
insert into target(id) values('1');
insert into target(id) values('2');
insert into target(id) values('3');
insert into target(id) values('4');
--更新查询出的数据,设置value值为111
update target set value = '111' where id in(select id from target where id between '1' and '4');
commit;用的oracle数据库
打碎云朵
TA贡献1条经验 获得超0个赞
那你的5条数据 必须有同一个字段 比如 name 5条数据都有name这个字段 name的值相等
那么你update的时候 根据 where name=xxx
他应该会找到所有name的 几条数据 更新
where id=xx的话 因为id只有一个 所有他只找到这一条id的数据
添加回答
举报
0/150
提交
取消
