SQL association question ABC three tables, SQL association question A \ B \ C three tables,. id = B. aid and. id = C. a2id. how do I write this association?
Reply to discussion (solution)
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = B. a2id
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
The previous one was wrong.
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
The previous one was wrong.
So how do we get the values in Table A and Table B and Table C? In case of the same name field
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
The previous one was wrong.
So how do we get the values in Table A and Table B and Table C? In case of the same name field
You can specify an alias. for example:
select A.name as aname,B.name as bname,C.name as cname from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
The previous one was wrong.
So how do we get the values in Table A and Table B and Table C? In case of the same name field
You can specify an alias. for example:
select A.name as aname,B.name as bname,C.name as cname from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
select A.*,B.*,C.* from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
The previous one was wrong.
So how do we get the values in Table A and Table B and Table C? In case of the same name field
You can specify an alias. for example:
select A.name as aname,B.name as bname,C.name as cname from Aleft join B on A.id = B.aidleft join C on A.id = C.a2id
How can I write this association in the form of join ("A on B. aid = A. id") of $ user-> join ("A on B. aid = A. id") in thinkphp?
Let's take a look at this: http://doc.thinkphp1.cn/manual/continuous_operation.html
Let's take a look at this: http://doc.thinkphp1.cn/manual/continuous_operation.html
I am in a hurry. I have no time to read it. please tell me. thank you.
$ User = M ('A ');
$ User-> join ("left join B on. id = B. id left join C on c. id = B. id ")-> field (". id as aid, B, id as bid ,...... ")-> Select ();