I have three different tables like department, employee and salary for SQL Server.

**Its structure**

```
CREATE TABLE department (DeptId INT,DeptName Varchar(100)) 
INSERT INTO department VALUES (1,'Accounts'); 
INSERT INTO department VALUES (2,'Package'); 

CREATE TABLE employee (EmpId INT,DeptId INT,EmpName varchar(20)) 
INSERT INTO employee VALUES (1,1,'Sachin'); 
INSERT INTO employee VALUES (2,1,'Vikas'); 
INSERT INTO employee VALUES (3,2,'Sikha'); 
INSERT INTO employee VALUES (4,2,'Disha'); 

CREATE TABLE salary(EmpId INT,Sal int) 
INSERT INTO salary VALUES (1,400); 
INSERT INTO salary VALUES (2,700); 
INSERT INTO salary VALUES (3,700); 
INSERT INTO salary VALUES (4,900); 

```

Result will be:

```
DepName  | EmpName
-----------------
Accounts | Vikas
Package  | Disha

```

Please help me on this, I need a query to find the required result.

> 
> I have tried below query, but not able get EmpName.
> 
> 
> 

```
select DeptName, max(Sal) as Salary from 
(select dep.DeptName, emp.EmpName, sal.Sal from salary as sal
inner join employee emp on emp.EmpId = sal.EmpId 
inner join department dep on dep.DeptId = emp.DeptId) as tbls 
group by DeptName

```