sql关联有关问题ABC三个表
程序员文章站
2024-01-31 11:23:04
...
sql关联问题A\B\C三个表,
sql关联问题A\B\C三个表,A.id = B.aid 和A.id= C.a2id,这种关联如何写?
------解决思路----------------------
------解决思路----------------------
$user = M('A');
$user->join("left join B on A.id=B.Id left join C on c.id=b.id")->field("A.id as aid,B,id as bid,……")->select();
sql关联问题A\B\C三个表,A.id = B.aid 和A.id= C.a2id,这种关联如何写?
------解决思路----------------------
select A.*,B.*,C.* from A
left join B on A.id = B.aid
left join C on A.id = B. a2id
------解决思路----------------------
$user = M('A');
$user->join("left join B on A.id=B.Id left join C on c.id=b.id")->field("A.id as aid,B,id as bid,……")->select();
相关文章
相关视频