Impact per user

1

Please login or register to vote for this query.

(click on this box to dismiss)

Hinduism Meta

Q&A about the site for followers of the Hindu religion and those interested in learning more about Hinduism

SELECT
  ISNULL(( SELECT
        SUM(q.ViewCount)
    FROM
        Posts q
    WHERE
        q.OwnerUserId = u.Id
    AND q.PostTypeId  = 1
  ),0) +
  ISNULL(( SELECT
        SUM(q.ViewCount)
    FROM
        Posts a
    INNER JOIN
        Posts q
    ON
        a.ParentId = q.Id
    WHERE
        q.PostTypeId  = 1
    AND a.PostTypeId  = 2
    AND a.OwnerUserId = u.Id
    AND a.Score       > 0
    AND (   a.Score >= 5
        OR  a.Id = q.AcceptedAnswerId
        OR  3 >
            ( SELECT
                  COUNT(*)
              FROM
                  Posts b
              WHERE
                  b.PostTypeId  = 2
              AND b.ParentId    = q.Id
              AND b.Score       > a.Score
            )
        OR  0.2 <= a.Score /
            ( SELECT
                  SUM(b.Score)
              FROM
                  Posts b
              WHERE
                  b.PostTypeId  = 2
              AND b.ParentId    = q.Id
            )
        )
  ),0) AS impact
FROM
    Users u
WHERE
    u.Id = ##UserId##

Enter Parameters

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