A UDF to calculate medians in MySQL.