How to add(merge) three or four table in a single SQL query ?

Total Post:25

Points:175
 155  View(s)
Ratings:
Rate this:

using FULL OUTER JOIN 

Table -1 + Table-2 + Table-3

  1. Post:46

    Points:324
    Re: How to add(merge) three or four table in a single SQL query ?

    Hi, Rahul

    Please, use this query ...

    1). If you want to Merge Two Tables...

    SELECT * FROM 
    
    Table_1
    FULL OUTER JOIN
    Table_2 ON Table_1.colomn_name = Table_2.column_name

    2). And if you want to add three or four table by a single query...

    SELECT * FROM 
    
    Table_1
    FULL OUTER JOIN
    Table_2 ON Table_1.EmployeeName = Table_2.EmployeeName
    FULL OUTER JOIN
    Table_3 ON Table_2.EmployeeName = Table_3.EmployeeName

    Note - Foreign keys must be used in all the tables in which the tables that we call them to join. This means that all those tables should have a common column name.

      Modified On Nov-27-2018 01:22:49 AM

Answer