Count of users with < 15 rep and get their ratio

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

SELECT 
  COUNT(CASE WHEN Reputation < 15 THEN 1 END) AS "< 15",
  COUNT(*) AS total,
  /* TODO reuse the above. */
  COUNT(CASE WHEN Reputation < 15 THEN 1 END) / CAST(COUNT(*) AS FLOAT) AS ratio
FROM
  Users

Enter Parameters

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