Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
414 B
3
Indexable
Never
SELECT tabl1.country_code AS country,
       MIN(tabl1.cnt) AS minc,  
       MAX(tabl1.cnt),  
       AVG(tabl1.cnt) AS av
FROM (SELECT country_code, 
             count(invested_companies) as cnt
      FROM fund
      WHERE founded_at BETWEEN '01.01.2010' AND '31.12.2012' 
      GROUP BY country_code
      ) AS tabl1
GROUP BY country
HAVING MIN(tabl1.cnt) <> 0 
ORDER BY av DESC, country
LIMIT 10 
Leave a Comment