Skip to content
Advertisement

Find the ‘count of employees’ per department & name of those counted employees present in EMP table

Considering the already known EMP table, structure like:

TABLE EMP(EMPNO, ENAME, DEPTNO)

I want to fetch ‘count of employees’ department wise & name of employees present in that department using sql queries.

Able to fetch limited data,

But this way I cant get the details of employees.

I am Expecting like:

Thanks in advance for good answers and facts.

Advertisement

Answer

Like p.Salmon said in the comments use GROUP_CONCAT

you can also add a ORDER BY ENAME DESC in thed GROUP_CONCAT if you want to sort the ENAME

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement