Skip to content
Advertisement

Query to find the city name with longest and shortest length

I’ve written a query to return me the cities with the shortest and longest length strings in a MS SQL SERVER database.

My difficulty is that I get duplicates, because I have a few cities that have the longest and shortest length. Also when I try to ORDER BY CITY in both sub queries it fails.

Any advice?

Advertisement

Answer

Another way:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement