select account_id , convert(nvarchar(40) ,null) displayname

0

Please login or register to vote for this query.

(click on this box to dismiss)

Earth Science

Q&A for those interested in the geology, meteorology, oceanography, and environmental sciences

select account_id
     , convert(nvarchar(40) ,null) displayname
     , sum(reputation) [total rep]
     , count(*) [# sites]
     , sum(question_count) [# questions]
     , sum(answer_count) [# answers]
     , min(s.database_name) [db]
into #accounts
from sede_users u
inner join sede_sites s on s.site_id = u.site_id
group by account_id
having sum(reputation) > 9000

exec sede_ineachdb @sqlcommand = '
  update #accounts 
  set displayname = du.displayname
  from #accounts u
  inner join users du on u.account_id = du.accountid
  where u.displayname is null',
  @includemainsites = 1,
  @includemetasites = 0,
  @includemainmeta = 1

select *
from #accounts
order by [total rep] desc


select u.account_id
     , s.*
     , d.database_name
     , d.site_type
from sede_users u
inner join sede_sites s on s.site_id = u.site_id
inner join sede_databases d on d.database_name = s.database_name
where account_id = 11683

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results