Advertisement
Guest User

15

a guest
Jun 7th, 2020
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.41 KB | None | 0 0
  1. SELECT rankedCurrencies.ContinentCode, rankedCurrencies.CurrencyCode, rankedCurrencies.Count
  2. FROM (
  3. SELECT c.ContinentCode, c.CurrencyCode, COUNT(c.CurrencyCode) AS [Count], DENSE_RANK() OVER (PARTITION BY c.ContinentCode ORDER BY COUNT(c.CurrencyCode) DESC) AS [rank]
  4. FROM Countries AS c
  5. GROUP BY c.ContinentCode, c.CurrencyCode) AS rankedCurrencies
  6. WHERE rankedCurrencies.rank = 1 and rankedCurrencies.Count > 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement