当前位置 博文首页 > magic幻风的博客:地址+区域字典联查
相当于对同一个表进行多次联查
SELECT
u.address_id,
u.recipients,
u.recipients_phone,
a.region_name AS provinceS,
b.region_name AS cityS,
c.region_name AS districtS,
u.recipients_address,
u.is_default_address
FROM
u_address u
LEFT JOIN region_dict a ON u.province = a.region_id
LEFT JOIN region_dict b ON u.city = b.region_id
LEFT JOIN region_dict c ON u.district = c.region_id
WHERE
u.user_id = 2