Q&A for people interested in statistics, machine learning, data analysis, data mining, and data visualization
SELECT COUNT(*) AS Total_Votes, datepart(year, Posts.CreationDate) AS YEAR_POST, datepart(week, Posts.CreationDate) AS WEEK_POST, SUM(CASE WHEN (DATEDIFF(day,Posts.CreationDate,Votes.CreationDate) > 7) THEN 1 ELSE 0 END) AS AFTER_WEEK FROM Votes INNER JOIN Posts ON Votes.PostId = Posts.Id WHERE Votes.VoteTypeId = 2 OR Votes.VoteTypeId = 3 GROUP BY datepart(year, Posts.CreationDate), datepart(week, Posts.CreationDate) ORDER BY YEAR_POST,WEEK_POST