I messed up with the strange behavior of the MySQL query. I have the following mysql query:
SELECT 'username','status', 'field_1', 'field_2', 'field_3', 'field_4',
FROM my_table
ORDER by field_1 DESC, field_2 DESC, field_3 DESC, field_4 DESC
LIMIT 0,10
In theory, he should order 10 rows in the descending method, depending on how many value fields the ORDER BY clause has. But as a result, I get the following:
Kate 103
pete 101
steve 102
instead
Kate 103
Steve 102 Pete
101
Does anyone know why he set the wrong order? And what to do to fulfill the proper ORDER BY DESC condition?
Is it possible to use MAX () for multiple fields? If so, is it possible to organize such a MySQL query?
SELECT 'username','status', 'field_1', 'field_2', 'field_3', 'field_4', MAX(field_1,field_2,field_3,field_4) AS total
FROM my_table
ORDER by total DESC
LIMIT 0,10