median of integers using mysql
How can I get the median of series of integers using mysql query.
The integers are in database.
here is a link to mysql Functions:
There is a User comment suggesting tying the following:
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(*)
assumes (COUNT(*)+1)/2 returns an int, if not
then use INT((COUNT(*)+1)/2)
There are variations for the varied defs of
Many thanks for the link.I will surely go through it now.
Thanks once again.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)