You are viewing a single comment's thread. Return to all comments →
Because if there are multiple results with the same length you will have to get the result that comes first alphabetically.
The ASC in the end of it can be ignored but I like to put them in for clarification :)
SELECT TOP 1 CITY, LEN(CITY) AS LENGTH FROM STATION ORDER BY LEN(CITY) ASC, CITY ASC; SELECT TOP 1 CITY, LEN(CITY) AS LENGTH FROM STATION ORDER BY LEN(CITY) DESC, CITY ASC;
Weather Observation Station 5
You are viewing a single comment's thread. Return to all comments →
Because if there are multiple results with the same length you will have to get the result that comes first alphabetically.
The ASC in the end of it can be ignored but I like to put them in for clarification :)