Q&A about the site for professional and amateur chefs
-- you can add the date in the creation date SELECT top 100 us.Id ,count(p.OwnerUserId) as cnt, us.DisplayName, CASE WHEN v.VoteTypeId = 2 THEN 5 WHEN v.VoteTypeId = 3 THEN -2 END as c_scr ,SUM(v.VoteTypeId) as [final_score] FROM votes v INNER JOIN Posts p on v.PostId = p.Id INNER JOIN Users us on p.OwneruserId = us.Id /*INNER JOIN (SELECT Id, count(Id) as cnt FROM Users GROUP BY Id) us on p.OwneruserId = us.Id*/ WHERE v.CreationDate between '2011-03-04 00:00:00' and '2011-03-11 00:00:00' AND (v.VoteTypeId = 2 OR v.VoteTypeId = 3) GROUP by us.Id,us.DisplayName,v.VoteTypeId order by final_score desc