s/42121/is-there-a-script-tool-to-calculate-the-rep-as-if-there-were-no-cap แก้ไขเพื่อใช้ User ID ที่ระบุ ไม่จำเป็นต้องใช้ตารางทั้งหมด .
s/42121/is-there-a-script-tool-to-calculate-the-rep-as-if-there-were-no-cap
Edited to use a specified User ID.It is not neccessary to use all the tables.
 PendingFlags:  Id [ number]  FlagTypeId [ number]  PostId [ number]  CreationDate [ time]  CloseReasonTypeId [ number]  CloseAsOffTopicReasonTypeId [ number]  DuplicateOfQuestionId [ number]  BelongsOnBaseHostAddress [ text] 
SELECT SUM(CASE WHEN VoteTypeId = 1 THEN 15 WHEN VoteTypeId = 2 THEN 10 WHEN VoteTypeId = 3 THEN -2 ELSE 0 END) - Reputation AS LostRep, 1.0 - (Reputation * 1.0 / SUM(CASE WHEN VoteTypeId = 1 THEN 15 WHEN VoteTypeId = 2 THEN 10 WHEN VoteTypeId = 3 THEN -2 ELSE 0 END)) AS "lostrep%" FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId INNER JOIN Users ON Users.Id = p.OwnerUserId WHERE p.OwnerUserId = @UserID AND p.CommunityOwnedDate IS NULL GROUP BY Reputation