Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- co.continent_code,
- (SELECT
- cr.currency_code
- FROM
- currencies AS cr
- INNER JOIN
- countries AS cou ON cou.currency_code = cr.currency_code
- WHERE
- co.continent_code = cou.continent_code
- GROUP BY cr.currency_code
- ORDER BY COUNT(cr.currency_code) DESC
- LIMIT 1) AS most,
- (SELECT
- count(cr.currency_code)
- FROM
- currencies AS cr
- INNER JOIN
- countries AS cou ON cou.currency_code = cr.currency_code
- WHERE
- co.continent_code = cou.continent_code
- GROUP BY cr.currency_code
- ORDER BY COUNT(cr.currency_code) DESC
- LIMIT 1) AS number_of_currencies
- FROM
- continents AS co
- INNER JOIN
- countries AS c ON c.continent_code = co.continent_code
- INNER JOIN
- currencies AS cu ON c.currency_code = c.currency_code
- GROUP BY most
- HAVING number_of_currencies > 1
- ORDER BY co.continent_code ASC , most ASC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement