This will be faster than the subquery count as it only need to read the table once. And you can also put the result into a temp table for each table count and select from the temp table at the end.create table #temp( tblName varchar(50), CounterEMP1 int, CounterEMP2 int)insert into #tempselect 'tblA' as tblName, count(case when EmployeeId = 'EMP1' then 1 end) AS CounterEMP1, count(case when EmployeeId = 'EMP2' then 1 end) AS CounterEMP2from tblA insert into #tempselect 'tblB' as tblName, count(case when EmployeeId = 'EMP1' then 1 end) AS CounterEMP1, count(case when EmployeeId = 'EMP2' then 1 end) AS CounterEMP2from tblBselect * from #temp
KH