mysql - SQL Count Number of "Employees" With "Salary" -
mysql - SQL Count Number of "Employees" With "Salary" -
i've got query i'd write. content of similar posting below:
select id, name, position, salary, (select count(salary 's') employees s = salary) numberofemployeeswithsalary employees hire_date between '2013-01-01' , '2014-12-31' essentially, after ability sum number of employees particular, dynamically-defined salary (so able form percentage off it). i've wracked brain on google, dev.mysql, , trying find answer.
i don't know if possible. may need separate out each "salary type" separate count query.
so, instance, if info contains:
salary ------ 30000 30000 30000 40000 40000 50000 i'd 3 30000, 2 40000, etc., intent of using result value in query grab percentage.
select salary, count(*) numberofemployeeswithsalary employees hire_date between '2013-01-01' , '2014-12-31' grouping salary;
try above query , should
salary numberofemployeeswithsalary ------ -------------------------- 30000 3 40000 2 50000 1 mysql
Comments
Post a Comment