Posts by user 'Zeta' sorted by length

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @userName VARCHAR(40) = 'Zeta';
DECLARE @userId INT = (SELECT Id FROM Users WHERE DisplayName = @userName);
SELECT
  Id AS [Post Link],
  CreationDate,
  LEN(Body) AS [Answer Length]
FROM
  Posts
WHERE
  OwnerUserId = @userId
  AND PostTypeId = 1 -- answer
GROUP BY
  Id,
  PostTypeId,
  CreationDate,
  LEN(Body)
ORDER BY
  [Answer Length] DESC

Enter Parameters

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