SELECT TOP 5 Input.Id [User Link], Input.Id, SUM(Daily_Sc...

0

Please login or register to vote for this query.

(click on this box to dismiss)

German Language Meta

Q&A about the site for speakers of German wanting to discuss the finer points of the language and translation

SELECT TOP 5
  Input.Id [User Link],
  Input.Id,
  SUM(Daily_Score)
FROM
  (
  SELECT
    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