NadezhdaGeorgieva

15.Continents and Currencies

Jun 10th, 2021
825
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     koko.*, MAX(koko.currency_usage) AS maxy
  3. FROM
  4.     (SELECT
  5.         c.continent_code,
  6.             v.currency_code,
  7.             COUNT(c.currency_code) AS 'currency_usage'
  8.     FROM
  9.         countries AS c
  10.     JOIN currencies AS v ON c.currency_code = v.currency_code
  11.     GROUP BY c.continent_code , v.currency_code
  12.     HAVING `currency_usage` > 1
  13.     ORDER BY c.continent_code , v.currency_code) AS koko
  14. GROUP BY koko.continent_code;
RAW Paste Data