I want to create a stored procedure Report_NEWTotal_Salary_ByDept
using (by
calling) the table function I created here:
select
e.Dept_No, d.Dept_Name, Count(e.Dept_No),
SUM(e.salary) as Sum_Salary,
AVG(e.salary) as AVE_Salary
from
EMPLOYEE e
join
DEPARTMENT d ON e.dno = d.dnumber
group by
e.Dept_No, d.Dept_Name
Basically I want to return a new table Report_NEWTotal_Salary_ByDept
. I want this table to have 7 new columns:
Dept_No (Int)
Dept_Name (Char(30))
COUNT_Emp (INT)
SUM_Salary (INT)
AVE_Salary (INT)
New_SUM_Salary (INT)
New_AVE_Salary (INT)
Here is what I have so far:
Create procedure Report_Newtotal_Salary_ByDept
@Dept_No
@Dept_Name(30)
As
set Count_Emp
Select
Sum_Salary, Ave_Salary, new_Ave_Salary
where
new ave_salary = ave_salary???
Please consider giving me advice on how to finish it.