select * from (SELECT DISTINCT p.OwnerUserId, p.Id AS pos...

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
*
from
(SELECT DISTINCT
p.OwnerUserId,
p.Id AS postId,
p.AnswerCount,
RANK() OVER (PARTITION BY p.OwnerUserId ORDER BY p.AnswerCount DESC) AS rank
FROM
Posts p
WHERE 1=1
AND p.OwnerUserId IN (
SELECT
    TOP 5 Id
FROM Users
WHERE 1=1
    AND Id <> -1
    ORDER BY Upvotes DESC )
    ) tab where rank < 6
    order by OwnerUserId

Enter Parameters

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