Ask a MySQL question. About getting the maximum value of a field in a query result ... (Sort by other fields)
This post was last edited by Anyilaoliu on 2013-05-21 16:21:32
Every time I ask for such a question is quite embarrassed ... But it's often too late to find a way to check the manual. Had to reach out again.
The problem is this. Make a regular query, in reverse order by field a. But want to get the maximum value of field B in this query
PHP does not seem to provide a function to get the maximum key value of a multidimensional array directly. To write their own sort is not impossible, but still want to ask in the MySQL side can be directly detected (and can not have too much performance loss or not as far as the PHP calculation)
Thank you MySQL query maximum value
Share to:
------Solution--------------------
MySQL provides a max function, but this is a clustering function that is not suitable for your scene
Is it not necessary to have a loop when extracting data? In the loop by the means (with the Max function) is not OK?