WITH voted_posts AS( SELECT v.postid id, t.name, count(v....

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Source Meta

Q&A about the site for people organizing, marketing or licensing open source development projects

WITH voted_posts AS(
SELECT v.postid id,
       t.name,
       count(v.id) votes_cnt,
       RANK() OVER (
       PARTITION BY t.name
       ORDER BY COUNT(v.id) DESC ) vote_rank
FROM votes v
JOIN votetypes t on v.votetypeid = t.id and t.name in('UpMod', 'DownMod')
GROUP BY v.postid, t.name
)
SELECT id
  FROM voted_posts
WHERE vote_rank <= 10;

Enter Parameters

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