sql - SQLPlus How to print the MAX of COUNT(*)? -


I need help printing the highest number of employees, because Max (COUNT (*)) is actually Does not work, can anyone help me in this?

Say that I have two table names which are department and ampe, each of which is deptno and empdeptno respectively. I need to calculate each department in each employee:

  SELECT dept.dptname "Department", (SELECT COUNT (*) emp WHERE emp.empdeptno = dept.deptno) "employees Number "from DEP order to COUNT (*) DESC;   

How do you print the department with the highest employee number without using LIMIT with ORDER BY?

  SELECT dept.dptname "Department", as COUNT (emp.empdeptno) " Number of Employees "from DEPT DEPTNO = emp.empdeptNO GROUP BY DEPT.Deptname ORDER BY COUNT (emp.empdeptno) DESC   

You can write by Group by DEPTUniqueDepartmentKey, dept.dptname If the dept.dptname key is unlikely

you mention the alias by the name of your SQL taste: Group "Department" May be needed.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -