Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT TOP(5) CountryName,
- HighestPeakElevation,
- LongestRiverLength
- FROM (SELECT c.CountryName AS [CountryName],
- Max(p.Elevation) AS [HighestPeakElevation],
- Max(r.Length) AS [LongestRiverLength]
- FROM countries AS c
- LEFT JOIN mountainscountries AS mc
- ON mc.countrycode = c.countrycode
- LEFT JOIN peaks AS p
- ON p.mountainid = mc.mountainid
- LEFT JOIN countriesrivers AS cr
- ON cr.countrycode = c.countrycode
- LEFT JOIN rivers AS r
- ON r.id = cr.riverid
- GROUP BY c.CountryName) AS cc
- ORDER BY HighestPeakElevation DESC,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement