USE AdventureWorks CREATE TABLE #tmpEmp (empid int, empPeople int) GO -- INSERT INTO #tmpEmp SELECT ManagerID,COUNT(*) FROM HumanResources.Employee GROUP BY ManagerID HAVING COUNT(*)>10 SELECT t.empid '主管編號', t.empPeople '所屬員工數量', E.Title '主管職稱', E.HireDate '到職日' FROM #tmpEmp t INNER JOIN HumanResources.Employee E ON t.empid=E.EmployeeID GO DROP TABLE #tmpEmp