Open posts with closed votes by year

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

DECLARE @year int = ##year##

select p.id AS [Post Link],
  count(v.id) TotalVotes
from posts p
inner join votes v
  on p.id = v.postid
where v.votetypeid = 6
  and p.closeddate is null
  and year(p.creationdate) = @year
  and p.viewcount < 100 
group by p.id
order by totalvotes desc

Enter Parameters

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