Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Chart
stackedtrue
width900
dataOrientationvertical
opacity75
height700


SQL
idmydata
dataSourcemars_apistats_new
SELECT profile_country.name, count(DISTINCT auth_user.username) as total_users
    FROM  profile_country
         RIGHT JOIN profile_profile ON profile_profile.country_id = profile_country.id
         RIGHT JOIN auth_user ON auth_user.id = profile_profile.user_id
         RIGHT JOIN users_stats_monthly ON users_stats_monthly.username = auth_user.username
    WHERE users_stats_monthly.dataset='tigge-global' and users_stats_monthly.month>=date'2006-01-01'
GROUP BY profile_country.name
HAVING count(DISTINCT auth_user.username)>=50
ORDER BY total_users DESC



info
SQL
idmydata
dataSourcemars_apistats_new
SELECT profile_country.nameto_char(month, 'YYYY') as year, count(DISTINCT auth_user.username) as "active total_users"
    FROM  profile_country
         RIGHT JOIN profile_profile ON profile_profile.country_id = profile_country.id
users_stats_monthly 
WHERE dataset='tigge-global' AND month>=date'2015-01-01' 
AND username IN (
      SELECT username         RIGHT JOIN auth_user ON auth_user.id = profile_profile.user_id
           
    RIGHT JOIN users_stats_monthlyFROM ON users_stats_monthly.username
 = auth_user.username
    WHERE users_stats_monthly.dataset='tigge-global'
 and users_stats_monthly.month>=date'2006-01-01'
     GROUP BY profile_country.name
username
      HAVING countsum(DISTINCT auth_user.username)>=50requests) >= 1
      )
GROUP BY year
ORDER BY total_users DESCyear;