homedevise
2016-09-27 22:09:22
如何把讀取出來的多條(小于5條)數(shù)據(jù)update更新,因為是小白。望詳細解答,謝謝!或者慕課上有相關(guān)教程發(fā)個鏈接也可以,謝謝
6 回答
已采納

逆光之羽
TA貢獻55條經(jīng)驗 獲得超13個贊
--建立測試數(shù)據(jù)表 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'); --更新查詢出的數(shù)據(jù),設(shè)置value值為111 update?target?set?value?=?'111'?where?id?in(select?id?from?target?where?id?between?'1'?and?'4'); commit;
用的oracle數(shù)據(jù)庫

打碎云朵
TA貢獻1條經(jīng)驗 獲得超0個贊
那你的5條數(shù)據(jù) 必須有同一個字段 ? 比如 name ? ?5條數(shù)據(jù)都有name這個字段 ?name的值相等
那么你update的時候 ?根據(jù) where name=xxx ?
他應(yīng)該會找到所有name的 幾條數(shù)據(jù) 更新
where id=xx的話 ? 因為id只有一個 ?所有他只找到這一條id的數(shù)據(jù)
添加回答
舉報
0/150
提交
取消