test

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

DECLARE @MyVar TABLE(Val INT)
INSERT INTO @MyVar(Val)
SELECT id from users order by reputation desc; 


with scores as (select cast(votes.CreationDate as Date) as date,
                       posts.OwnerUserId as uid,
                       sum(case VoteTypeId when 1 then 15
                                           when 2 then case PostTypeId when 1 then 
                                                   case when votes.CreationDate >= '03/19/2010' then 5 
                                                        when votes.CreationDate < '03/19/2010' then 10 end
								  when 2 then 10 end
                                           when 3 then -2 
				           when 16 then 2 end
			  	) as score
                from votes
                     inner join posts on posts.Id = votes.PostId
                     where posts.OwnerUserId IN ('1') 
                      and posts.CommunityOwnedDate is null
                group by votes.CreationDate,posts.OwnerUserId)
                 
                 select top 1 id,reputation,calcReputation,(reputation-calcReputation) as Diff from users join (select uid,date, sum(score) over (order by date) as calcReputation
from  scores) as temp1 on temp1.uid=users.id order by calcReputation desc;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results