Weather Observation Station 20

  • + 0 comments

    Declare @total int SET @total = (Select Count(LAT_N) from Station);

    WITH median as( SELECT lat_n, ROW_NUMBER() OVER(ORDER BY lat_n) AS rn FROM station)

    Select CAST(AVG(CAST(LAT_N as DECIMAL(10,4))) as Decimal(10,4)) from median where median.rn in ((@total+1)/2, (@total+2)/2);