Kishore Kumar Kishore Kumar - 1 year ago 41
SQL Question

How to display employee details along with sum(sal) of all employees?

Is it possible to display employee details like the below using SQL?

Emp_id, Emp_name, Emp_Sal, Sum(Emp_Sal)

Note: Here
is total sum of all the employees.

Answer Source

You can get your expected result in this way:

SELECT Emp_id, Emp_name, Emp_Sal, (SELECT SUM(Emp_Sal) FROM Employee) AS TotalSalary
FROM Employee

Working DEMO