You are viewing a single comment's thread. Return to all comments →
It is outside as you want to return just rownum = 1 from the inner query. The inner query is getting all the city and lengths, then orders it, the outside query is selecting all and then grabbing rownum = 1 from the inner query. If you do rownum = 1 in the inner query it will return the first row before it does the order by clause so you will not get the desired results.
https://www.periscopedata.com/blog/sql-query-order-of-operations for more details