The simplest query to find the Median
SELECT x.val from table x, table y GROUP BY x.val HAVING SUM(SIGN(1-SIGN(y.val-x.val))) = (COUNT(*) +1)/2
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.