WITH predvyber AS ( SELECT COUNT(PostTypeId) AS pocet, Us...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow Meta en español

Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática

WITH predvyber AS (
  SELECT
    COUNT(PostTypeId) AS pocet,
    Users.Id,
    Users.DisplayName
  FROM
    Posts
  JOIN
    Users ON Posts.OwnerUserId = Users.Id
  GROUP BY
    Users.Id,
    Users.DisplayName
)

SELECT
  ROUND(
    CAST(
      (SELECT
         COUNT(Users.Id)
      FROM
        Users
      LEFT JOIN
        Posts ON Posts.OwnerUserId = Users.Id
      WHERE
        Posts.PostTypeId IS NULL) AS float
     ) / (SELECT COUNT(Users.Id) FROM Users) * 100, 2) AS '0',
  ROUND(
    CAST(
      COUNT(
        CASE
        WHEN predvyber.pocet <= 10 AND predvyber.pocet >= 1 THEN predvyber.Id
        END) AS float
    ) / (SELECT COUNT(Users.Id) FROM Users) * 100, 2) AS '1-10',
  ROUND(
    CAST(
      COUNT(
        CASE
        WHEN predvyber.pocet > 10 THEN predvyber.Id
        END) AS float
    ) / (SELECT COUNT(Users.Id) FROM Users) * 100, 2) AS '>10'
FROM
  predvyber;

Enter Parameters

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