Percentage of the total rep of users with "monica" substring (only active in the last 2 months)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Monero Meta

Q&A about the site for developers and users of the secure, private and untraceable cryptocurrency Monero

WITH Raw AS (
  SELECT OwnerUserId AS UserId
  FROM Posts
  WHERE
    CreationDate > DATEADD(d, -60, CURRENT_TIMESTAMP)
    AND
    OwnerUserId > 0

  UNION

  SELECT UserId
  FROM Comments
  WHERE
    CreationDate > DATEADD(d, -60, CURRENT_TIMESTAMP)
    AND
    UserId > 0
),
Raw2 AS (
  SELECT UserId
  FROM Raw
  GROUP BY UserId
),
Raw3 AS (
  SELECT
    SUM(Users.Reputation) AS AllRep,
    SUM(
      CASE
        WHEN LOWER(Users.DisplayName) LIKE '%monica%'
        THEN Users.Reputation
        ELSE 0
      END) AS MonicaRep
  FROM Users, Raw2
  WHERE Raw2.UserId = Users.Id
)
SELECT AllRep, MonicaRep, 100.0 * MonicaRep / AllRep AS MonicaPct FROM Raw3;

Enter Parameters

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