Total post count by location by post type

0

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

SELECT
[u].[Location] [Location],
[pt].[Name] [Post type],
COUNT(1) [Total post count]
FROM [Users] [u] (NOLOCK)
JOIN [Posts] [p] (NOLOCK) ON [p].[OwnerUserId] = [u].[Id]
JOIN [PostTypes] [pt] (NOLOCK) ON [pt].[Id] = [p].[PostTypeId]
WHERE
  [p].[PostTypeId] < 4 AND
  [p].[ClosedDate] IS NULL AND
  LEN([u].[Location]) > 0
GROUP BY [u].[Location], [pt].[Name]
HAVING COUNT(1) > 20
ORDER BY [Total post count] DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results