First off, your data is bad: no department has more than two employees in that data, and some employees appear to be pulling a salary from two departments, which is ... um ... odd.
If you assume that you meant "more than one" employee to a Department, then it can be done very easily.
Start by grouping employees together by department: that's trivial, it's just a
GROUP BY
statement with a
HAVING
clause to restrict it to 2 or more employees:
GROUP BY DeptNo
HAVING COUNT(EmpId) >= 2
Then you can apply your aggregate function to the groups:
SELECT DeptNo, SUM(Sal) AS Total FROM Employees
GROUP BY DeptNo
HAVING COUNT(EmpId) >= 2
And that gives you the result you need:
DeptNo Total
1 6000
2 8000