table1:
field1 field2
101 100
102 200
103 300
table2:
field1 field2
101 111
102 222
如果運行如下語句:
update table1 set field2=(select max(field2) from table2
where table1.field1=table2.field1)
where exists(select field2 from table2
where table1.field1=table2.field1);
update xmstc.student s set
s.city =(
select a1.areaname from xmstc.area a1 where a1.areaid = (
select a2.parentid as id2 from gk.area a2 where a2.areaname = du.city and a2.depth =3
)
) where exists (
select areaname from xmstc.area a3 where a3.city = a3.areaname and a3.depth =3
)