Inner Joining three tables

前端 未结 5 604
甜味超标
甜味超标 2020-11-30 17:47

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

相关标签:
5条回答
  • 2020-11-30 18:37
    dbo.tableA AS A INNER JOIN dbo.TableB AS B
    ON A.common = B.common INNER JOIN TableC C
    ON B.common = C.common
    
    0 讨论(0)
  • 2020-11-30 18:46
    select *
    from
        tableA a
            inner join
        tableB b
            on a.common = b.common
            inner join 
        TableC c
            on b.common = c.common
    
    0 讨论(0)
  • 2020-11-30 18:47

    try the following code

    select * from TableA A 
    inner join TableB B on A.Column=B.Column 
    inner join TableC C on A.Column=C.Column
    
    0 讨论(0)
  • 2020-11-30 18:47

    try this:

    SELECT * FROM TableA
    JOIN TableB ON TableA.primary_key = TableB.foreign_key 
    JOIN TableB ON TableB.foreign_key = TableC.foreign_key
    
    0 讨论(0)
  • 2020-11-30 18:49

    Just do the same thing agin but then for TableC

    SELECT *
    FROM dbo.tableA A 
    INNER JOIN dbo.TableB B ON A.common = B.common
    INNER JOIN dbo.TableC C ON A.common = C.common
    
    0 讨论(0)
提交回复
热议问题