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:
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.