读书人

求oracle SQL批改多行记录

发布时间: 2012-11-09 10:18:48 作者: rapoo

求oracle SQL修改多行记录
请问怎么用一个SQL修改多行记录。

现在有2张表,gap_organize,gap_ele_agency.他们 字段都有ID,Code,现在里面有200条数据。

gap_organize里面有个字段为Type, type=2 对应的code都在gap_ele_agency表里面,但是gap_ele_agency的ID却不是gap_organize的ID,现在要修改成一样 的.

两个表如下图;




[解决办法]

SQL code
update gap_ele_agency set ID=(select ID from gap_organize where ORG_TYPE_ID=2 and code=gap_ele_agency.code); 

读书人网 >oracle

热点推荐