Skip to content
Advertisement

Query help in SQL

I have the below table, with empid, deptid, and Name. I need to get the results as empid,deptid,name and count of employees in each department.

I need to get the results as empid,deptid,name, and count of employees in each department as below.

enter image description here

I am able to achieve results using the below queries.

Is it possible to do this in alternate ways?

Advertisement

Answer

No need for CTE. Just do

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