Created
May 26, 2020 07:44
-
-
Save gmantri/c1aafdf437fda547d9f0c73dcc63af09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select Users.Id, | |
Users.DisplayName, | |
Min(Posts.CreationDate) as FirstAnswerProvidedDate, | |
Max(Posts.CreationDate) as LastAnswerProvidedDate, | |
Count(Distinct(Posts.Id)) As AnswersProvided, | |
SUM(CASE WHEN Votes.VoteTypeId = 1 THEN 1 ELSE 0 END) AS AcceptedAnswers, | |
SUM(CASE WHEN Votes.VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes, | |
SUM(CASE WHEN Votes.VoteTypeId = 3 THEN 1 ELSE 0 END) AS Downvotes | |
From Users | |
Left Join Posts on Users.Id = Posts.OwnerUserId | |
Left Join Votes on Posts.Id = Votes.PostId | |
Where Posts.PostTypeId = 2 And Users.Id = <enter-your-user-id-here> | |
And (Posts.CreationDate >= '2020-05-01') | |
Group By Users.Id, Users.DisplayName | |
Order By AnswersProvided |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment