Users by average down / answer

1

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla Meta

Q&A about the site for Joomla! administrators, users, developers and designers

WITH Userdown AS (
  SELECT
    Posts.OwnerUserId AS UserId,
    COUNT(*) AS Downs
  FROM Posts, Votes
  WHERE
    Posts.PostTypeId = 2
    AND
    Votes.PostId = Posts.Id
    AND
    Votes.VoteTypeId = 3
    AND
    Posts.OwnerUserId > 0
  GROUP BY Posts.OwnerUserId
),
UserA AS (
  SELECT
    Posts.OwnerUserId AS UserId,
    COUNT(*) AS Answers
  FROM Posts
  WHERE
    Posts.PostTypeId = 2
    AND
    Posts.OwnerUserId > 0
  GROUP BY Posts.OwnerUserId
)
SELECT TOP ##TopN:int?100##
  Userdown.UserId AS [User Link],
  UserA.Answers,
  Userdown.Downs,
  1.0 * Userdown.Downs / UserA.Answers AS DownPerA
FROM Userdown, UserA
WHERE
  Userdown.UserId = UserA.UserId
  AND
  UserA.Answers >= ##MinAnswer:int?10##
ORDER BY DownPerA DESC, Userdown.UserId

Enter Parameters

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