Q&A for people interested in the history and origins of science and mathematics
-- Top users per tag declare @limit int = 10; declare @tag_name nvarchar(35) = 'snowflake-datawarehouse'; declare @tag_id int = (select id from tags where tagname = @tag_name); select top (@limit) rank() over (order by sum(answers.score) desc) "Rank", users.id "User Link" ,sum(answers.score) as "Score" from users join posts answers on (users.id = answers.owneruserid) join posts parent on (answers.parentid = parent.id) join posttags on (parent.id = posttags.postid) where posttags.tagid = @tag_id and answers.posttypeid = 2 -- answers only --and answers.CreationDate >= '2019-10-07' and users.id in ('9842780', '1196458','8339066', '12165756', '12271204', '6745597', '12271851' ,'12272119' ,'12185665' ,'73221' ,'12200988' ,'12256505' ,'12241026' ,'12276146' ,'12284087' ,'12273225' ,'5531887' ,'8731644' ,'12290405' ,'12294561' ,'12187527' ,'12309330' ,'12174761' ,'12285135' ,'3737478' ,'12319120' ,'12319116' ,'12322273') group by users.id having sum(answers.score) > 0 order by sum(answers.score) desc ;