fix mysql bad ordering syntax