update region a
set a.region_code=
(select b.city_pinyin from china_city b where a.region_name = b.city_name)
where exists
(select 1
from china_city b
where a.region_name = b.city_name)
本文介绍了一种使用SQL更新表中区域代码的方法,通过联接另一个包含城市拼音的城市表来实现自动填充。这种方法可以大大提高数据处理效率,并确保数据的一致性和准确性。
update region a
set a.region_code=
(select b.city_pinyin from china_city b where a.region_name = b.city_name)
where exists
(select 1
from china_city b
where a.region_name = b.city_name)
2551

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