Q&A for professional and enthusiast programmers
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 select du.displayname [Link] , a.[total rep] from #accounts a inner join users du on du.accountid = a.account_id where a.db = db_name()