Weather Observation Station 5

  • + 1 comment

    I tried a bunch of different things but for some reason I couldn't get them to work. And writing two different queries was giving me the right results but column headers in the middle for some reason. I ended up creating at temp table and inserting into that. Perhaps not the most elegant or efficient solution, but solved it for TSQL, lol.

    Create table #temp(
    City varchar (21),
    Length int
    );
    
    Insert INTO #temp
    Select Top 1 City, LEN(City) as Length
    FROM Station Order By Length desc, City asc;
    
    Insert INTO #temp
    Select Top 1 City, LEN(City) as Length
    FROM Station Order By Length asc, City asc;
    
    Select * from #temp;