📜  如何在 SQL 中查找 IDD 和偶数的中位数 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:29.359000             🧑  作者: Mango

代码示例2
SET @rowindex := -1;
 
SELECT
   AVG(g.grade)
FROM
   (SELECT @rowindex:=@rowindex + 1 AS rowindex,
           grades.grade AS grade
    FROM grades
    ORDER BY grades.grade) AS g
WHERE
g.rowindex IN (FLOOR(@rowindex / 2) , CEIL(@rowindex / 2));