select 工作人员,总数 =count(*) from tablename group by 工作人员
declare @table table (工作人员 varchar(1)) insert into @table select 'a' union all select 'b' union all select 'c'select *,总数=(select count(*) from @table)from @table/* 工作人员 总数 ---- ----------- a 3 b 3 c 3 */刚才理解差了。
declare @table table (工作人员 varchar(1))
insert into @table
select 'a' union all
select 'b' union all
select 'c'select *,总数=(select count(*) from @table)from @table/*
工作人员 总数
---- -----------
a 3
b 3
c 3
*/刚才理解差了。