MySQL :: MySQL 3.23, 4.0, 4.1 Reference Manual :: 11.15.1 GROUP BY (Aggregate) Functions
For medians in almost any SQL: SELECT x.val from data x, data y GROUP BY x.val HAVING SUM(SIGN(1-SIGN(y.val-x.val))) = (COUNT(*) +1)/2 assumes (COUNT(*)+1)/2 returns an int, if not then use INT((COUNT(*)+1)/2) There are variations for the varied defs of...