s.ไม่จำเป็นที่จะต้องใช้ทุกตาราง
s.It is not neccessary to use all the tables.
 PostLinks:  Id [ number]  CreationDate [ time]  PostId [ number]  RelatedPostId [ number]  LinkTypeId [ number] 
WITH Raw AS (SELECT SUM(CASE WHEN Votes.VoteTypeId = 2 THEN 5 WHEN Votes.VoteTypeId = 3 THEN -2 ELSE 0 END) + CASE WHEN NOT MIN(Posts.AcceptedAnswerId) IS NULL THEN 2 ELSE 0 END AS Rep, Posts.Id, MIN(Posts.OwnerUserId) AS UserId FROM Posts LEFT JOIN Votes ON Votes.VoteTypeId BETWEEN 2 AND 3 AND Posts.Id = Votes.PostId WHERE Posts.PostTypeId = 1 AND Posts.OwnerUserId > 0 AND NOT Posts.CommunityOwnedDate IS NULL GROUP BY Posts.Id) SELECT DENSE_RANK() OVER (ORDER BY SUM(Rep) DESC) AS Rank, UserId AS "user_link", UserId, SUM(Rep) AS Rep FROM Raw GROUP BY UserId ORDER BY Rep DESC, UserId