mysql 一个表有多个键 对应另一个表的id
程序员文章站
2023-12-25 10:04:09
...
mysql 一个表有多个键 对应另一个表的id
两个表的对应关系:
两个表的对应关系:
$user_address=D('UserAddress')->query("SELECT m.id,name,phone,address,m.province,n.areaname,m.city,o.areaname as area2name, m.district,p.areaname as area3name FROM `ez_user_address` as m INNER JOIN ez_area as n on m.province=n.id INNER JOIN ez_area as o on m.city=o.id INNER JOIN ez_area as p on m.district=p.id WHERE m.id=1");
// dump($user_address);exit;
打印结果: