Creating Inner Join on Multiple Tables in SQL Server

This blog will give you an idea of how to join three or more tables and also defines the join in SQL Server.

Creating Table in SQL Server
 
Now to create 3 tables in the Master database named Table1, Table2 and Table3.

Table1

CREATE TABLE Table1

(

ID INT, Name VARCHAR(20)

)

Table2

CREATE TABLE Table2

(

ID INT, Name VARCHAR(30)

)

Table3

CREATE TABLE Table3

(

ID INT, Name VARCHAR(40)

)

 

Now enter some data for Table1, Table2 and Table3.

Inner Join with Three Tables

Example

In this example we use all three of the preceding tables; table1, Table2 and table3 and adding it using an Inner Join.

Select table1.ID ,table1.Name from Table1 inner join Table2 on Table1 .ID =Table2 .ID

 inner join Table3 on table2.ID=Table3 .ID