我想对3个不同的列执行以下查询3次 (pc = t1.postal_code,t1.postal_code_2,t1.postal_code_3)。
update addresses t1 set
admin_name1 = t.admin_name1,
admin_name2 = t.admin_name2,
admin_name3 = t.admin_name3,
admin_name4 = t.admin_name4,
from (
select * from all_countries) t
where t.postal_code = pc and t1.country_ = t.country ;
有没有办法只编写一次代码,例如通过循环,该如何实现?