SELECT Input.Id [User Link], SUM(Daily_Score) FROM ( SELE...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Reverse Engineering Meta

Q&A about the site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation

SELECT
  Input.Id [User Link],
  SUM(Daily_Score)
FROM
  (
  SELECT TOP 100
    u.Id,
    DATEADD(day, DATEDIFF(day, 0,v.CreationDate), 0) AS TimeStamp,
      CASE
        WHEN 
          SUM(CASE 
            WHEN v.VoteTypeId = 2 THEN 10
            WHEN v.VoteTypeId = 3 THEN -2 
            ELSE NULL
            END) > 200 THEN 200 
        ELSE 
          SUM(CASE 
            WHEN v.VoteTypeId = 2 THEN 10
            WHEN v.VoteTypeId = 3 THEN -2 
            ELSE NULL
            END)
        END
        AS Daily_Score

  FROM 
    Users u
  JOIN Posts p ON p.OwnerUserId = u.Id
  JOIN Votes v ON v.PostId = p.Id
  GROUP BY u.id, DATEDIFF(day, 0,v.CreationDate)
  ) AS Input
--JOIN SuggestedEdits e ON e.OnwerUserId = u.Id 
GROUP BY Input.Id

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results