Vote count extremes by date

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

declare @UserId int = ##UserId##;

select top 10
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0) as Upvotes_Day,
  count(votes.Id) as Upvote_Count
from votes, posts
where
  votes.VoteTypeId = 2
  and posts.OwnerUserId = @UserId
  and votes.PostId = posts.Id
group by
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0)
order by
  Upvote_Count desc;
  
select top 10
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0) as Accepts_Day,
  Convert(int,count(votes.Id)) as Accept_Count
from votes, posts
where
  votes.VoteTypeId = 1
  and posts.OwnerUserId = @UserId
  and votes.PostId = posts.Id
group by
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0)
order by
  Accept_Count desc;
  
select top 10
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0) as Downvotes_Day,
  count(votes.Id) as Downvote_Count
from votes, posts
where
  votes.VoteTypeId = 3
  and posts.OwnerUserId = @UserId
  and votes.PostId = posts.Id
group by
  DATEADD(dd,(DATEDIFF(dd,0,votes.CreationDate)),0)
order by
  Downvote_Count desc;

Enter Parameters

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