Top answers for tag from previous month

0

Please login or register to vote for this query.

(click on this box to dismiss)

More correctly this is the previous calendar month

German Language Meta

Q&A about the site for speakers of German wanting to discuss the finer points of the language and translation

select top 100
     a.id as [Post Link]
   , q.score as [Q Score]
   , a.score as [A Score]
   , cast(case when q.AcceptedAnswerId = a.id then 1 else 0 end as bit) as Accepted
   , q.creationdate as [Post Date]
   , q.answercount as [Answers]
   , q.tags as [Tags]
from posts q 
inner join posttags pt 
      on pt.postid = q.id
inner join tags t 
      on t.id = pt.tagid
inner join string_split(##tags:string?delphi,extjs##,',') sel 
      on sel.value = t.tagname
inner join posts a
      on a.ParentId = q.id
where 
1=1 -- simplifies predicate editing
and a.PostTypeId = 2 -- Answer
and q.creationdate between -- one month before end of last month 
  DateAdd(month, -1,  DateAdd(month, DateDiff(month, 0,GetDate()), -1))  
  and DateAdd(month, DateDiff(month, 0,GetDate()), -1) -- End of Last Month
and a.score > 1
and q.score > 1
and q.acceptedanswerid is not null
and q.closeddate is null -- not closed
order by a.score desc

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results