SQL的update多個字段的寫法


第一種寫法:update a set (c1,c2,c3) =(select c1,c2,c3 from b where......) where ......;

第二種寫法比較笨:update test set a= '11 ',b = '22 ' where id=1

例如:update omcw_owner.MR_RULE_RECORD
set alarm_rule='1月 至 12月: 年度計划 -2 <= 指標值 < 年度計划',warm_rule='1月 至 12月: 指標值 < 年度計划 -2'
where alarm_rule='1月 至 12月: 年度計划 - -2 <= 指標值 < 年度計划' and warm_rule='1月 至 12月: 指標值 < 年度計划 - -2';

insert 也可以適用。批量插入數據。
insert into persons (id_p, lastname , firstName, city ) values (select id_,lastname,forstName,city from personA wehere id_p<"123")

insert into persons

(id_p, lastname , firstName, city )

values

https://blog.csdn.net/rockpk008/article/details/46294299

(200,'haha' , 'deng' , 'shenzhen'),

(201,'haha2' , 'deng' , 'GD'),

(202,'haha3' , 'deng' , 'Beijing');


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM