MySQL一条语句算出中位数
SELECT 
  GROUP_CONCAT(id),
  AVG(yw) 
FROM
  (SELECT 
    id,
    yw,
    @index := @index + 1 myIndex 
  FROM
    cjfx_cj_2016,
    (SELECT 
      @index := 0) a 
  where testid=8
  ORDER BY yw) b 
WHERE FLOOR(@index / 2+1) = myIndex 
  OR CEIL(@index / 2) = myIndex
  
MySQL一条语句算出众数  
SELECT yw, count(yw) 
from cjfx_cj_2016 where testid=8
GROUP BY yw

HAVING count(yw) >=

(SELECT max(a.b) 

from
(SELECT count(yw) as b 
   from cjfx_cj_2016 where testid=8
GROUP BY yw) a )