Weather Observation Station 5

  • + 2 comments

    This works, but I thought for a moment that in the case where a result set includes cities with the same length the query might fail if you don't do

    order by city

    Say the result set looks like this:

    • CITY
    • Bb
    • Aa

    Then wouldn't select distinct top 1 city,LEN(city) from station order by len(city)

    return Bb instead of Aa.