Skip to content
Advertisement

Inner Joining three tables

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?

Advertisement

Answer

select *
from
    tableA a
        inner join
    tableB b
        on a.common = b.common
        inner join 
    TableC c
        on b.common = c.common
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement