select count(1) as nums, sd.name from [Master].[dbo].[SYSPROCESSES] spinner join [Master].[dbo].[SYSDATABASES] sd on sp.dbid=sd.dbid--where --sd.name ...
select
count(1) as nums,
sd.name
from
[Master].[dbo].[SYSPROCESSES] sp
inner join [Master].[dbo].[SYSDATABASES] sd
on sp.dbid=sd.dbid
--where
--sd.name in ('sjk1','sjk2')
--and sp.program_name='.Net SqlClient Data Provider'
group by
sd.name