INNER JOIN THREE TABLES (SSMS)

Kosovari_ 81 Reputation points
2021-09-23T23:32:28.607+00:00

I have these tables as below :

1). Employees table with Column SuperVisorID
2). Departments table with Column name of Departments (....)

3). Supervisor table with Columns : Name, LastName, SupervisorId .

I have edited in TOP 200 ROWS

How to Execute on QUERY IN SQL SERVER 2019 PROGRAM (SSMS) SYNTAX IN CORRECT WAY ??

Azure SQL Database
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,552 questions
{count} votes

Accepted answer
  1. MelissaMa-MSFT 24,176 Reputation points
    2021-09-24T02:18:03.483+00:00

    Hi @Kosovari_

    Welcome to Microsoft Q&A!

    What is your issue and where are executing the query?

    If it is on-premises SQL Server, you could refer below example and check whether it is working.

    --DDL  
    create table Employees   
    (EmployeeID int,  
    Name varchar(20),  
    LastName varchar(20),  
    DepartID int,  
    SuperVisorID int)  
      
    create table Departments   
    (DepartID int,  
    Name varchar(20))  
      
    create table Supervisor   
    (SuperVisorID int,  
    Name varchar(20),  
    LastName varchar(20))  
      
    --insert sample data  
    insert into Employees values  
    (10001,'Ann','Green',101,20001),  
    (10002,'Tom','Blue',101,20002),  
    (10003,'Jim','Red',102,20003)  
      
    insert into Departments values  
    (101,'Develop'),  
    (102,'HR')  
      
    insert into Supervisor values  
    (20001,'Jerry','O'),  
    (20002,'Lim','P'),  
    (20003,'Kim','Q')  
    
    --query using inner join  
    select a.EmployeeID,a.Name EmployeeName,a.LastName  EmployeeLastName,  
    b.Name DepartmentName,c.Name SupervisorName,c.LastName SupervisorLastName  
    from Employees a  
    inner join Departments b on a.DepartID=b.DepartID  
    inner join Supervisor c on a.SuperVisorID=c.SuperVisorID  
    

    Output:

    134871-output.png

    Best regards,
    Melissa


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Tom Phillips 17,716 Reputation points
    2021-09-24T12:15:28.077+00:00

    SSMS does not have the ability to create a UI to edit multiple tables at once. SSMS only has the ability to edit data in a single table.