mysql php sort by highest of 3 separate fields -
i've got table 3 separate scores in 3 separate fields:
user / score 1 / score 2 / score 3 person 1: 10 21 7 person 2: 17 4 20 person 3: 1 5 22
is there mysql command sort each person out highest score 3 fields.
so here need return:
person 3: 1 5 22 person 1: 10 21 8 person 2: 17 4 20
the way can think of doing put them in array, check each number each person against each other find highest, sort them different array.
this seems long-winded , labour intensive though.
add order greatest(score1,score2,score3) desc
manual greatest()
Comments
Post a Comment