select sum(Up) as UpSum, sum(Down) as DownSum from ( select

0

Please login or register to vote for this query.

(click on this box to dismiss)

Super User

Q&A for computer enthusiasts and power users

select 
 sum(Up) as UpSum,
 sum(Down) as DownSum
from (
 select
  (select count(*) from Votes v where v.VoteTypeId = 2 and v.PostId = p.Id) as Up,
  (select count(*) from Votes v where v.VoteTypeId = 3 and v.PostId = p.Id) as Down
 from Posts p inner join Users u on u.Id = p.OwnerUserId
 where 
  u.Reputation <= ##RepCutoff## and
  p.PostTypeId = 1 and
  ABS(DATEDIFF(d, p.CreationDate, GETDATE())) < ##MaxAgeInDays##
) Split

Enter Parameters

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