Hong Kong user ranking

0

Please login or register to vote for this query.

(click on this box to dismiss)

CiviCRM Meta

Q&A about the site for administrators and users of the CiviCRM Constituent Relationship Management software

select loc, 
avg(rep) as 'average', 
count(rep) as 'count', 
max(rep) as 'max', 
sum(rep) as 'total', 
cast(
  round(
    cast(max(rep) as float)/cast(sum(rep) as float) * 100
    ,0)
as int) as 'top-to-total-ratio',
cast(
  round(
    cast((sum(rep) - max(rep)) as float)/cast((count(rep) - 1) as float)
  ,0)
as int) as 'avg-without-top' 

from
    
(SELECT
  Lower(Location) as loc,
  Reputation as rep
    
FROM
    Users
    
    Where LOWER(Location) IN ('hong kong')
order by rep desc 
offset 1 row
) as A
    
group by loc

Enter Parameters

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