Why am I getting a SQL syntax error when trying to calculate the median in MySQL