Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inner Joining three tables

Tags:

sql

sql-server

I have three tables I wish to inner join by a common column between them.

Say my tables are;

TableA TableB TableC 

I wish to join A-B, but then also B-C all by this common field I will call common.

I have joined two tables like this;

dbo.tableA AS A INNER JOIN dbo.TableB AS B ON A.common = B.common 

How do I add the third one?

like image 813
William Avatar asked Aug 06 '12 08:08

William


1 Answers

select * from     tableA a         inner join     tableB b         on a.common = b.common         inner join      TableC c         on b.common = c.common 
like image 143
podiluska Avatar answered Oct 05 '22 09:10

podiluska