Created
February 2, 2012 21:46
-
-
Save gdalgas/1725969 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 | |
(Select SUM(VoterRepChange) | |
From Posts2Votes v | |
Where UserId = @Id | |
And VoteTypeId = 1) as AskerAcceptsAnswer, | |
(Select SUM(-VoterRepChange) | |
From Posts2Votes v | |
Where UserId = @Id | |
And DeletionDate Is Not Null | |
And VoteTypeId = 1) as AskerUnacceptsAnswer, | |
(Select SUM(TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And VoteTypeId = 1) as AnswerAccepted, | |
(Select SUM(-TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And DeletionDate Is Not Null | |
And VoteTypeId = 1) as AnswerUnaccepted, | |
(Select SUM(VoterRepChange) | |
From Posts2Votes v | |
Where UserId = @Id | |
And VoteTypeId = 3) as VoterDownvotes, | |
(Select SUM(-VoterRepChange) | |
From Posts2Votes v | |
Where UserId = @Id | |
And DeletionDate Is Not Null | |
And VoteTypeId = 3) as VoterUndownvotes, | |
(Select SUM(TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And VoteTypeId = 3) as PostDownvoted, | |
(Select SUM(-TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And DeletionDate Is Not Null | |
And VoteTypeId = 3) as PostUndownvoted, | |
(Select SUM(TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And VoteTypeId = 2) as PostUpvoted, | |
(Select SUM(-TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And DeletionDate Is Not Null | |
And VoteTypeId = 2) as PostUnupvoted, | |
(Select SUM(TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And VoteTypeId = 12) as PostFlaggedAsSpam, | |
(Select SUM(TargetRepChange) | |
From Posts2Votes v | |
Where TargetUserId = @Id | |
And VoteTypeId = 4) as PostFlaggedOffensive, | |
(Select SUM(VoterRepChange) | |
From Posts2Votes v | |
Where UserId = @Id | |
And VoteTypeId = 8) as BountyGiven, | |
(Select SUM(Reputation) | |
From UserHistory v | |
Where UserId = @Id | |
And UserHistoryTypeId In (14, 54)) as AssociationBonus | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test test