首页 电脑 电脑学堂 查看内容

批量查询结果作为更新的值

2014-12-18 11:33 797 0

摘要: 业务需求:需要将a表中 type为1 的数据的source_id更新为新的id。因为之前的id是存储在p_server中,现在更新到了server_info表中[sql] view plai...
关键词: nbsp server source id index code info 更新 type plaincopyupdate

业务需求:需要将a表中 type为1 的数据的source_id更新为新的id。因为之前的id是存储在p_server中,现在更新到了server_info表中[sql] view plaincopyupdate 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;  
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部