sql关联有关问题ABC三个表

WBOY
Release: 2016-06-13 12:09:43
Original
929 people have browsed it

sql关联问题A\B\C三个表,
sql关联问题A\B\C三个表,A.id = B.aid   和A.id= C.a2id,这种关联如何写?
------解决思路----------------------

<br />select A.*,B.*,C.* from A<br />left join B on A.id = B.aid<br />left join C on A.id = B. a2id<br />
Copy after login

------解决思路----------------------
$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(); 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template