Which communities has the most users in Stack Exchange?

0

Please login or register to vote for this query.

(click on this box to dismiss)

http://meta.stackexchange.com/questions/278778/which-communities-has-the-most-users-in-stack-exchang

Physics

Q&A for active researchers, academics and students of physics

-- all databases
declare  db_c cursor for select [name] 
                         from sys.databases 
                         where database_id > 5 -- skip master, temp, model, msdb, Data.SE

declare @db_c_name sysname   -- holds name of db after fetch
declare @sql nvarchar(max) -- holds build up sql string

-- result table
create table #all_users ( site nvarchar(250)
                            , cnt int
                            );

open db_c
fetch next from db_c into @db_c_name
while(@@FETCH_STATUS = 0)
begin
    set @sql = N'use '+ QUOTENAME(@db_c_name) +';
    insert into #all_users 
    select '''+ QUOTENAME(@db_c_name) +''', count(*) from Posts';
    exec (@sql)
   fetch next from db_c into @db_c_name
end;
close db_c;
deallocate db_c;

select * from #all_users-- all databases
order by cnt desc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results