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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -