update photo_asset_station
set photo_asset_station.city_org_code = (select o_org.ORG_NO
from o_org
where substr(o_org.ORG_NAME, 3, 2) = substr(photo_asset_station.city_code, 1, 2)and o_org.ORG_TYPE =3 )
where uuid is not null
update photo_asset_station
set photo_asset_station.org_no = (select o_org.ORG_NO
from o_org
where instr(o_org.ORG_NAME ,substr(photo_asset_station.district_code, 1, 2))>0 and o_org.ORG_TYPE =4 )
where uuid is not null
该更新语句涉及两个SQL子查询,用于根据城市代码和区县代码匹配并更新photo_asset_station表中的org_no字段。它查找o_org表中与station.city_code和station.district_code匹配的ORG_NO,条件是o_org.ORG_TYPE分别为3和4。

被折叠的 条评论
为什么被折叠?



