WITH top_posts AS ( SELECT [p].[Id] ,[p].[OwnerUserId] ,[...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

WITH top_posts AS (
  SELECT [p].[Id]
        ,[p].[OwnerUserId]
        ,[p].[Title]
        ,[p].[CreationDate]
        ,[p].[ViewCount]
        ,ROW_NUMBER() OVER (
            PARTITION BY [p].[OwnerUserId]
            ORDER BY [p].[ViewCount] DESC) AS rn
    FROM [Posts] AS [p]  
   WHERE CAST([p].[CreationDate] AS date) >= DATEADD(m,-3,GETDATE())
     AND [p].[ViewCount] >= 1 
)

 SELECT [u].[DisplayName]
       ,[p].[Title]
       ,[p].[CreationDate]
       ,[p].[ViewCount]
   FROM [top_posts] AS p
   JOIN [Users] AS u
     ON [u].[Id] = [p].[OwnerUserId]
  WHERE [p].[rn] <= 3

Enter Parameters

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