1.由人员计算出总数,在部门树(tree)按结构汇总(主父绑定) CREATE function [dbo].[GetEmpDepNum] ( @ID int ) RETURNS @Tree Table (ID [, ),PID Int,FID Int,SN Varchar(), Name Varchar(), Num Varchar()) as begin declare @MaxNum int,@i int,@f int,@sNnm int Insert @Tree SELECT c1.pi…