Q&A about the site for programming puzzle enthusiasts and code golfers
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 AS "Uživatel Id", U.DisplayName AS "Jméno uživatele", RP.Title AS "Titulek", RP.ViewCount AS "Počet zobrazení", RP.CreationDate AS "Datum vytvoření" FROM RecentPosts RP JOIN Users U ON RP.OwnerUserId = U.Id WHERE RP.RowNum <= 3 ORDER BY RP.OwnerUserId, RP.ViewCount DESC;