How much attention to Bounties generate on posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @postViews int
declare @bountyPostViews int

select @bountyPostViews = avg(p.viewcount) 
from posts p
inner join votes v on p.Id = v.PostId
where posttypeid = 1 and v.votetypeid = 8
and p.creationdate >= dateadd(month,datediff(month,0,getdate()) - 1,0)
and p.creationdate <= dateadd(day,-1,dateadd(month,datediff(month,-2,getdate()),0))

select @postViews = avg(p.viewcount) 
from posts p
where posttypeid = 1
and p.creationdate >= dateadd(month,datediff(month,0,getdate()) - 1,0)
and p.creationdate <= dateadd(day,-1,dateadd(month,datediff(month,-2,getdate()),0))

select @postViews as AvgPostViewsSept2014, @bountyPostViews as AvgBountyViewsSept2014

Enter Parameters

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