SELECT OwnerUserId AS UserId, Id AS PostId, Answ...

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
    OwnerUserId AS UserId,
    Id          AS PostId,
    AnswerCount
FROM
(
    SELECT DISTINCT
        p.OwnerUserId,
        p.Id,
        p.AnswerCount,
        ROW_NUMBER() 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 1=1
    AND Rank < 6
ORDER BY OwnerUserId, AnswerCount DESC

Enter Parameters

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