select departments.dept_name, count(employees.emp_no) from employees left join departments on employees.department = department.dept_no group by department.dept_no Code (markup):
Column departments is not in table employees. It is in table v_full_employees. I need to get first column of all departments and second of number workers employeed in certain department. select departments.dept_name, count(v_full_employees.emp_no) from departments left join v_full_employees on v_full_employees.department = departments.dept_no group by departments.dept_no This code is correct. I think. Thanks.
This code shows only that titles which count is not 0. I need column of all titles. What do I need to fix?
Your where clause requires that view7 has a value, so you'll never get all the titles with that query. What are you trying to find out with the "Customer Service" bit?
I want to count how many employeed into any department (for example: Custome Service) have title Senior Engineer,Staff,...
try select alltitles.title, count(view7.id) from alltitles left join view7 on alltitles.title = view7.title group by alltitles.title order by 2 DESC Code (markup):
In second row just need to continue : 'and view7.department="Customer Service"' and I think code is correct. Thanks
try select view7.department, alltitles.title, count(view7.id) as countup from alltitles left join view7 on alltitles.title = view7.title group by view7.department, alltitles.title order by 2 DESC Code (markup):