WITH RecentPosts AS ( SELECT P.Id AS PostId, P.OwnerUserId,

0

Please login or register to vote for this query.

(click on this box to dismiss)

GenAI Meta

Q&A for GenAI enthusiasts and practitioners and those interested in learning more about using GenAI tools

WITH RecentPosts AS (
    SELECT 
        P.Id AS PostId, 
        P.OwnerUserId, 
        P.Title, 
        P.ViewCount, 
        P.CreationDate,
        ROW_NUMBER() OVER (PARTITION BY P.OwnerUserId ORDER BY P.ViewCount DESC) AS RowNum
    FROM Posts P
    WHERE P.CreationDate >= DATEADD(MONTH, -3, GETDATE()) 
      AND P.ViewCount > 0
)
SELECT 
    RP.OwnerUserId, 
    U.DisplayName, 
    RP.Title, 
    RP.ViewCount, 
    RP.CreationDate
FROM RecentPosts RP
JOIN Users U ON RP.OwnerUserId = U.Id
WHERE RP.RowNum <= 3
ORDER BY RP.OwnerUserId, RP.ViewCount DESC;

Enter Parameters

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