Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 38.2Mb
PDF (A4) - 38.3Mb
PDF (RPM) - 33.1Mb
HTML Download (TGZ) - 8.1Mb
HTML Download (Zip) - 8.1Mb
HTML Download (RPM) - 7.0Mb
Man Pages (TGZ) - 133.2Kb
Man Pages (Zip) - 189.3Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  The Maximum Value for a Column

3.6.1 The Maximum Value for a Column

What is the highest item number?

SELECT MAX(article) AS article FROM shop;

+---------+
| article |
+---------+
|       4 |
+---------+

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by Kobus Myburgh on November 5, 2013
I can not find anything confirming this, but my tests indicate that if you use MAX() on a field with an alpha-numeric value (such as ETA-000001), it does calculate the MAX() correctly, providing the number is padded by 0's.

To get a better (and probably more syntactically correct) result, you could use the following:

MAX(SUBSTRING(reference_number FROM 5 FOR 6))

for the example number given above.
Sign Up Login You must be logged in to post a comment.