数据库 批量查询结果作为更新的值,批量查询结果
数据库批量更新。
业务需求:
需要将a表中 type为1 的数据的source_id更新为新的id。
因为之前的id是存储在p_server中,现在更新到了server_info表中
update a set source_id = s.server_id from (select p_server.p_id,p_server.index_code,server_info.server_id from p_server join server_info on p_server.index_code = server_info.index_code) s where a.source_id = s.p_id and type = 1;
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。