SELECT OwnerUserId AS ownerUserId, Id AS PostId,...

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 ownerUserId,
    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 rank < 6
    order by OwnerUserId, AnswerCount DESC

Enter Parameters

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