Skip to content
Advertisement

How to query for city name as well as length of the smallest city name from the same table

My code is this but gives error, don’t know why. Please help!

Advertisement

Answer

If you just want the city with the shortest name, you can simply order by and limit:

This returns just one row. On the other hand, if you want to allow bottom ties, then you can filter with a subquery, like so:

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