Mysql Function Select Into Arraylist Sorting