Weather Observation Station 20

  • + 0 comments

    set @tot = (select count(id) from station);

    select case when mod(@tot,2)=0 then (select round(avg(lat_n),4) from (select *,row_number() over (order by lat_n) as rown from station) sub where rown=(@tot/2) or rown=(@tot/2-1)) else (select round(lat_n,4) from (select *,row_number() over (order by lat_n) as rown from station) sub where rown=ceil(@tot/2)) end;