更新时间:2023-02-21 20:14:31
我想您要一个城市,首先检查5位数的邮政编码,然后再检查3位数的邮政编码:
I am guessing that you want one city, first checking the 5-digit zip code and then the 3-digit one:
select mc.*, coalesce(zc5.city_name, zc3.city_name) as city_name
from main_cohort mc left join
zip_code zc5
on mc.zip_value5 = zc5.zip_code left join
zip_code zc3
on mc.zip_value3 = zc3.zip_code