You are viewing a single comment's thread. Return to all 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);
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 20
You are viewing a single comment's thread. Return to all 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);