/* query used to generate the all_users cte select 'sele...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

/*
query used to generate the all_users cte 

select 'select accountid, ''' + replace([name],'StackExchange.','') +''' , (select count(*) from [' +[name]+ '].dbo.users )  from [' +[name]+ '].dbo.users union all '
from sys.databases 
where database_id > 5 -- skip master, temp, model, msdb, Data.SE
and name not like '%.Meta%'
and name not in (
  'StackExchange.Meta'
  , 'Stackoverflow'
  , 'ServerFault'
  , 'Superuser')
*/
; with all_users as (
select accountid, 'StackApps' as site , (select count(*) from [StackApps].dbo.users ) as tot from [StackApps].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                                         
select accountid, 'Academia' , (select count(*) from [StackExchange.Academia].dbo.users )  from [StackExchange.Academia].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Android' , (select count(*) from [StackExchange.Android].dbo.users )  from [StackExchange.Android].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Anime' , (select count(*) from [StackExchange.Anime].dbo.users )  from [StackExchange.Anime].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Apple' , (select count(*) from [StackExchange.Apple].dbo.users )  from [StackExchange.Apple].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Arduino' , (select count(*) from [StackExchange.Arduino].dbo.users )  from [StackExchange.Arduino].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Astronomy' , (select count(*) from [StackExchange.Astronomy].dbo.users )  from [StackExchange.Astronomy].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Audio' , (select count(*) from [StackExchange.Audio].dbo.users )  from [StackExchange.Audio].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Aviation' , (select count(*) from [StackExchange.Aviation].dbo.users )  from [StackExchange.Aviation].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Beer' , (select count(*) from [StackExchange.Beer].dbo.users )  from [StackExchange.Beer].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                            
select accountid, 'Bicycles' , (select count(*) from [StackExchange.Bicycles].dbo.users )  from [StackExchange.Bicycles].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Biology' , (select count(*) from [StackExchange.Biology].dbo.users )  from [StackExchange.Biology].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Bitcoin' , (select count(*) from [StackExchange.Bitcoin].dbo.users )  from [StackExchange.Bitcoin].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Blender' , (select count(*) from [StackExchange.Blender].dbo.users )  from [StackExchange.Blender].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Boardgames' , (select count(*) from [StackExchange.Boardgames].dbo.users )  from [StackExchange.Boardgames].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Bricks' , (select count(*) from [StackExchange.Bricks].dbo.users )  from [StackExchange.Bricks].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Buddhism' , (select count(*) from [StackExchange.Buddhism].dbo.users )  from [StackExchange.Buddhism].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Chemistry' , (select count(*) from [StackExchange.Chemistry].dbo.users )  from [StackExchange.Chemistry].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Chess' , (select count(*) from [StackExchange.Chess].dbo.users )  from [StackExchange.Chess].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Chinese' , (select count(*) from [StackExchange.Chinese].dbo.users )  from [StackExchange.Chinese].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Christianity' , (select count(*) from [StackExchange.Christianity].dbo.users )  from [StackExchange.Christianity].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Codegolf' , (select count(*) from [StackExchange.Codegolf].dbo.users )  from [StackExchange.Codegolf].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Codereview' , (select count(*) from [StackExchange.Codereview].dbo.users )  from [StackExchange.Codereview].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Coffee' , (select count(*) from [StackExchange.Coffee].dbo.users )  from [StackExchange.Coffee].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Cogsci' , (select count(*) from [StackExchange.Cogsci].dbo.users )  from [StackExchange.Cogsci].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Cooking' , (select count(*) from [StackExchange.Cooking].dbo.users )  from [StackExchange.Cooking].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Craftcms' , (select count(*) from [StackExchange.Craftcms].dbo.users )  from [StackExchange.Craftcms].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Crypto' , (select count(*) from [StackExchange.Crypto].dbo.users )  from [StackExchange.Crypto].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Cs' , (select count(*) from [StackExchange.Cs].dbo.users )  from [StackExchange.Cs].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                                  
select accountid, 'Cstheory' , (select count(*) from [StackExchange.Cstheory].dbo.users )  from [StackExchange.Cstheory].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Datascience' , (select count(*) from [StackExchange.Datascience].dbo.users )  from [StackExchange.Datascience].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Dba' , (select count(*) from [StackExchange.Dba].dbo.users )  from [StackExchange.Dba].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Diy' , (select count(*) from [StackExchange.Diy].dbo.users )  from [StackExchange.Diy].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Drupal' , (select count(*) from [StackExchange.Drupal].dbo.users )  from [StackExchange.Drupal].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Dsp' , (select count(*) from [StackExchange.Dsp].dbo.users )  from [StackExchange.Dsp].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Earthscience' , (select count(*) from [StackExchange.Earthscience].dbo.users )  from [StackExchange.Earthscience].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Ebooks' , (select count(*) from [StackExchange.Ebooks].dbo.users )  from [StackExchange.Ebooks].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Economics' , (select count(*) from [StackExchange.Economics].dbo.users )  from [StackExchange.Economics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Electronics' , (select count(*) from [StackExchange.Electronics].dbo.users )  from [StackExchange.Electronics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Ell' , (select count(*) from [StackExchange.Ell].dbo.users )  from [StackExchange.Ell].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Emacs' , (select count(*) from [StackExchange.Emacs].dbo.users )  from [StackExchange.Emacs].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Engineering' , (select count(*) from [StackExchange.Engineering].dbo.users )  from [StackExchange.Engineering].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'English' , (select count(*) from [StackExchange.English].dbo.users )  from [StackExchange.English].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Expatriates' , (select count(*) from [StackExchange.Expatriates].dbo.users )  from [StackExchange.Expatriates].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Expressionengine' , (select count(*) from [StackExchange.Expressionengine].dbo.users )  from [StackExchange.Expressionengine].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all        
select accountid, 'Fitness' , (select count(*) from [StackExchange.Fitness].dbo.users )  from [StackExchange.Fitness].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Freelancing' , (select count(*) from [StackExchange.Freelancing].dbo.users )  from [StackExchange.Freelancing].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'French' , (select count(*) from [StackExchange.French].dbo.users )  from [StackExchange.French].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'GameDev' , (select count(*) from [StackExchange.GameDev].dbo.users )  from [StackExchange.GameDev].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Gaming' , (select count(*) from [StackExchange.Gaming].dbo.users )  from [StackExchange.Gaming].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Garage' , (select count(*) from [StackExchange.Garage].dbo.users )  from [StackExchange.Garage].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Gardening' , (select count(*) from [StackExchange.Gardening].dbo.users )  from [StackExchange.Gardening].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Genealogy' , (select count(*) from [StackExchange.Genealogy].dbo.users )  from [StackExchange.Genealogy].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'German' , (select count(*) from [StackExchange.German].dbo.users )  from [StackExchange.German].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Gis' , (select count(*) from [StackExchange.Gis].dbo.users )  from [StackExchange.Gis].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Graphicdesign' , (select count(*) from [StackExchange.Graphicdesign].dbo.users )  from [StackExchange.Graphicdesign].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                 
select accountid, 'Ham' , (select count(*) from [StackExchange.Ham].dbo.users )  from [StackExchange.Ham].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Hermeneutics' , (select count(*) from [StackExchange.Hermeneutics].dbo.users )  from [StackExchange.Hermeneutics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Hinduism' , (select count(*) from [StackExchange.Hinduism].dbo.users )  from [StackExchange.Hinduism].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'History' , (select count(*) from [StackExchange.History].dbo.users )  from [StackExchange.History].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Homebrew' , (select count(*) from [StackExchange.Homebrew].dbo.users )  from [StackExchange.Homebrew].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Hsm' , (select count(*) from [StackExchange.Hsm].dbo.users )  from [StackExchange.Hsm].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Islam' , (select count(*) from [StackExchange.Islam].dbo.users )  from [StackExchange.Islam].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Italian' , (select count(*) from [StackExchange.Italian].dbo.users )  from [StackExchange.Italian].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Japanese' , (select count(*) from [StackExchange.Japanese].dbo.users )  from [StackExchange.Japanese].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Joomla' , (select count(*) from [StackExchange.Joomla].dbo.users )  from [StackExchange.Joomla].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Judaism' , (select count(*) from [StackExchange.Judaism].dbo.users )  from [StackExchange.Judaism].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Lifehacks' , (select count(*) from [StackExchange.Lifehacks].dbo.users )  from [StackExchange.Lifehacks].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Linguistics' , (select count(*) from [StackExchange.Linguistics].dbo.users )  from [StackExchange.Linguistics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Magento' , (select count(*) from [StackExchange.Magento].dbo.users )  from [StackExchange.Magento].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Martialarts' , (select count(*) from [StackExchange.Martialarts].dbo.users )  from [StackExchange.Martialarts].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Math' , (select count(*) from [StackExchange.Math].dbo.users )  from [StackExchange.Math].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                            
select accountid, 'Matheducators' , (select count(*) from [StackExchange.Matheducators].dbo.users )  from [StackExchange.Matheducators].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                 
select accountid, 'Mathematica' , (select count(*) from [StackExchange.Mathematica].dbo.users )  from [StackExchange.Mathematica].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Mathoverflow' , (select count(*) from [StackExchange.Mathoverflow].dbo.users )  from [StackExchange.Mathoverflow].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Moderators' , (select count(*) from [StackExchange.Moderators].dbo.users )  from [StackExchange.Moderators].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Money' , (select count(*) from [StackExchange.Money].dbo.users )  from [StackExchange.Money].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Movies' , (select count(*) from [StackExchange.Movies].dbo.users )  from [StackExchange.Movies].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Music' , (select count(*) from [StackExchange.Music].dbo.users )  from [StackExchange.Music].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Musicfans' , (select count(*) from [StackExchange.Musicfans].dbo.users )  from [StackExchange.Musicfans].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Networkengineering' , (select count(*) from [StackExchange.Networkengineering].dbo.users )  from [StackExchange.Networkengineering].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all  
select accountid, 'Opendata' , (select count(*) from [StackExchange.Opendata].dbo.users )  from [StackExchange.Opendata].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Outdoors' , (select count(*) from [StackExchange.Outdoors].dbo.users )  from [StackExchange.Outdoors].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Parenting' , (select count(*) from [StackExchange.Parenting].dbo.users )  from [StackExchange.Parenting].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Patents' , (select count(*) from [StackExchange.Patents].dbo.users )  from [StackExchange.Patents].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Pets' , (select count(*) from [StackExchange.Pets].dbo.users )  from [StackExchange.Pets].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                            
select accountid, 'Philosophy' , (select count(*) from [StackExchange.Philosophy].dbo.users )  from [StackExchange.Philosophy].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Photography' , (select count(*) from [StackExchange.Photography].dbo.users )  from [StackExchange.Photography].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Physics' , (select count(*) from [StackExchange.Physics].dbo.users )  from [StackExchange.Physics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Pm' , (select count(*) from [StackExchange.Pm].dbo.users )  from [StackExchange.Pm].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                                  
select accountid, 'Poker' , (select count(*) from [StackExchange.Poker].dbo.users )  from [StackExchange.Poker].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Politics' , (select count(*) from [StackExchange.Politics].dbo.users )  from [StackExchange.Politics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Productivity' , (select count(*) from [StackExchange.Productivity].dbo.users )  from [StackExchange.Productivity].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Programmers' , (select count(*) from [StackExchange.Programmers].dbo.users )  from [StackExchange.Programmers].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Puzzling' , (select count(*) from [StackExchange.Puzzling].dbo.users )  from [StackExchange.Puzzling].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Quant' , (select count(*) from [StackExchange.Quant].dbo.users )  from [StackExchange.Quant].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Raspberrypi' , (select count(*) from [StackExchange.Raspberrypi].dbo.users )  from [StackExchange.Raspberrypi].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                       
select accountid, 'Reverseengineering' , (select count(*) from [StackExchange.Reverseengineering].dbo.users )  from [StackExchange.Reverseengineering].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all  
select accountid, 'Robotics' , (select count(*) from [StackExchange.Robotics].dbo.users )  from [StackExchange.Robotics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Rpg' , (select count(*) from [StackExchange.Rpg].dbo.users )  from [StackExchange.Rpg].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Russian' , (select count(*) from [StackExchange.Russian].dbo.users )  from [StackExchange.Russian].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Salesforce' , (select count(*) from [StackExchange.Salesforce].dbo.users )  from [StackExchange.Salesforce].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Scicomp' , (select count(*) from [StackExchange.Scicomp].dbo.users )  from [StackExchange.Scicomp].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Scifi' , (select count(*) from [StackExchange.Scifi].dbo.users )  from [StackExchange.Scifi].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Security' , (select count(*) from [StackExchange.Security].dbo.users )  from [StackExchange.Security].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Sharepoint' , (select count(*) from [StackExchange.Sharepoint].dbo.users )  from [StackExchange.Sharepoint].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Skeptics' , (select count(*) from [StackExchange.Skeptics].dbo.users )  from [StackExchange.Skeptics].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Softwarerecs' , (select count(*) from [StackExchange.Softwarerecs].dbo.users )  from [StackExchange.Softwarerecs].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Sound' , (select count(*) from [StackExchange.Sound].dbo.users )  from [StackExchange.Sound].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Space' , (select count(*) from [StackExchange.Space].dbo.users )  from [StackExchange.Space].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Spanish' , (select count(*) from [StackExchange.Spanish].dbo.users )  from [StackExchange.Spanish].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Sports' , (select count(*) from [StackExchange.Sports].dbo.users )  from [StackExchange.Sports].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Sqa' , (select count(*) from [StackExchange.Sqa].dbo.users )  from [StackExchange.Sqa].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Startups' , (select count(*) from [StackExchange.Startups].dbo.users )  from [StackExchange.Startups].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                
select accountid, 'Stats' , (select count(*) from [StackExchange.Stats].dbo.users )  from [StackExchange.Stats].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                         
select accountid, 'Sustainability' , (select count(*) from [StackExchange.Sustainability].dbo.users )  from [StackExchange.Sustainability].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all              
select accountid, 'Tex' , (select count(*) from [StackExchange.Tex].dbo.users )  from [StackExchange.Tex].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Tor' , (select count(*) from [StackExchange.Tor].dbo.users )  from [StackExchange.Tor].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                               
select accountid, 'Travel' , (select count(*) from [StackExchange.Travel].dbo.users )  from [StackExchange.Travel].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Tridion' , (select count(*) from [StackExchange.Tridion].dbo.users )  from [StackExchange.Tridion].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Ubuntu' , (select count(*) from [StackExchange.Ubuntu].dbo.users )  from [StackExchange.Ubuntu].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                      
select accountid, 'Unix' , (select count(*) from [StackExchange.Unix].dbo.users )  from [StackExchange.Unix].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                            
select accountid, 'Ux' , (select count(*) from [StackExchange.Ux].dbo.users )  from [StackExchange.Ux].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                                  
select accountid, 'Vi' , (select count(*) from [StackExchange.Vi].dbo.users )  from [StackExchange.Vi].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                                  
select accountid, 'WebApps' , (select count(*) from [StackExchange.WebApps].dbo.users )  from [StackExchange.WebApps].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'Webmasters' , (select count(*) from [StackExchange.Webmasters].dbo.users )  from [StackExchange.Webmasters].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                          
select accountid, 'Windowsphone' , (select count(*) from [StackExchange.Windowsphone].dbo.users )  from [StackExchange.Windowsphone].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                    
select accountid, 'Wordpress' , (select count(*) from [StackExchange.Wordpress].dbo.users )  from [StackExchange.Wordpress].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Workplace' , (select count(*) from [StackExchange.Workplace].dbo.users )  from [StackExchange.Workplace].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                             
select accountid, 'Worldbuilding' , (select count(*) from [StackExchange.Worldbuilding].dbo.users )  from [StackExchange.Worldbuilding].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                 
select accountid, 'Writers' , (select count(*) from [StackExchange.Writers].dbo.users )  from [StackExchange.Writers].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                   
select accountid, 'StackOverflow.Br' , (select count(*) from [StackOverflow.Br].dbo.users )  from [StackOverflow.Br].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  union all                                    
select accountid, 'StackOverflow.Ja' , (select count(*) from [StackOverflow.Ja].dbo.users )  from [StackOverflow.Ja].dbo.users where reputation > 200 and datediff(d, lastaccessdate, getdate()) < 60  -- union all                                    
)


select site
     , count(*) as [only here]
     , min(tot) as [total users]
     , round(
          cast(count(*) as decimal (9,2)) 
        / cast((min(tot) ) as decimal(9,2)) 
        * 100 
       , 2) as [perc]
from all_users a
inner join (
  -- all accountid's with their count
  select accountid 
       , count(*) as cnt
  from all_users
  group by accountid
  having count(*) = 1 -- active on exactly ONE site
  ) one on one.accountid = a.accountid
group by site
order by 4 desc

Enter Parameters

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