select p.id, count(v.id), 'upvote' from posts p left join...

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

select p.id, count(v.id), 'upvote' 
from posts p
left join votes v on p.id = v.postid
left join votetypes t on v.votetypeid = t.id and t.name = 'upvote' 
where 1 = 1
--and p.id <= 10000
group by p.id
order by count(v.id) desc;

Enter Parameters

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