Q&A for professional and enthusiast programmers
select top 10000 Users.Id as [User Link], Users.LastAccessDate as [Last Seen], max(Posts.CreationDate) as [Last Post], Users.Reputation as [Rep], sum(case Posts.PostTypeId when 1 then 1 else 0 end) as [Questions], sum(case Posts.PostTypeId when 2 then 1 else 0 end) as [Answers], count(Posts.Id) as [Total], sum(case Posts.PostTypeId when 1 then Posts.Score else 0 end) as [QScore], sum(case Posts.PostTypeId when 2 then Posts.Score else 0 end) as [AScore], sum(Posts.Score) as [Total Score] from Users join Posts on Posts.OwnerUserId = Users.Id where Users.LastAccessDate < ##LastSeenBefore:string?2018-05-02## group by Users.Id, Users.LastAccessDate, Users.Reputation order by Users.Reputation desc