Number of upvotes depending on age of the post (in weeks)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science Meta

Q&A about the site for scientists using computers to solve scientific problems

;with votes_cte as (
SELECT DATEDIFF(week, p.CreationDate, v.CreationDate) AS Weeks, v.Id as vid
FROM Votes v JOIN Posts p ON v.PostId=p.Id
WHERE VoteTypeId=2
)

SELECT Weeks, COUNT(*) FROM votes_cte
GROUP BY Weeks
ORDER BY Weeks

--VoteTypeId:
--1 = AcceptedByOriginator
--2 = UpMod (AKA upvote)
--3 = DownMod (AKA downvote)

--DATEDIFF returns the number of times the given period changed (for 23:59:00 and 00:01:00 the next day it returns 1 days, for 2018-12-31 and 2019-01-01 it returns 1 months/years)

Enter Parameters

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