Please tell me the solution that how to sum salary department wise as per image:
Thanks in Advance!
SELECT Name, sum(Salary), Dept FROM employees GROUP BY dept;
Elect sum((salary) * 10) from employee group by department.
Please follow last line (Show Final Result). final result means: salary=1000*10=10000 its only one value but table contain 6 value. 6 value working same job and finally sum all result (6 value after multiple).
select sum( select salary*10 from employee ) from employee group by dept.
The first comment by Rohit is right. Can't make it righter anymore.
Select sum((salary*10)) from employee group by dept with roll up. It will give sum after every dept and grand sum of all departments. let me know after trying, im giving this query of sql server, tested in sql server 2008 and 2014.
Select name,salary*10 as salary,dept from employee group by dept.
Select sum (salary*10) as salary from employee Group by dept with roll up.
min_level number:=1; -- Minimum Level Define $1
next_level number:=500; -- Next Level Define $500
min_comm number:=25; -- Minimum Commission Define 25%
next_comm number:=30; -- Next Commission Define 30%
case when sum(salamt)>min_level then sum(salamt*min_comm/100) end
into v_result from salesdtl group by COMMID;
This query has an error: "ORA-01422: exact fetch returns more than requested number of rows".
I know this error is showing for "group by COMMID". But how can handle this error without no change "group by COMMID"
Either iterate through the records using a loop or use a collection. In other words Your v_result has to be a record type.
Alternatively (If ur business logic allows this),
Sign up for STechies
Ask Question From Our Experts