简体   繁体   中英

SQL Query to join 3 tables with only two tables have common entity

I have 3 tables : Table A , Table B and Table C.

Table A has 3 columns Column A,Column B,Column C
Table B has 3 columns Column A,Column D, Column E
Table C has 2 columns Column F , Column E

with Inner Join i was able to query on Table A and Table B and Table B and Table C but for my result to be solved I would require data by merging A and C as well.

Well given the little info provided I'd say that it would be as simple as this:

SELECT A, B, C 
FROM A
JOIN B on A.A = B.A
JOIN C on B.E = C.E

Ofcourse if there are no matches on table B you wont get any on table C

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM