Search the MySQL manual:

3.5.1 The Maximum Value for a Column

``What's the highest item number?''

SELECT MAX(article) AS article FROM shop

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

User Comments

Posted by [name withheld] on Tuesday February 26 2002, @8:56am[Delete] [Edit]

When you select
max(date_format(col_name, "fstring"))
the maximum alphabetic string is returned, not
the maximum date. Need to create a temporary
table to get the max date, first, then select
again to format the date. Is this correct
behavior?

Posted by [name withheld] on Thursday August 29 2002, @10:04am[Delete] [Edit]

select max(col_name), date_format
(col_name, "fstring") group by col_name;

This is an add workaround, but it would work. This
would return the appropiate (most recent or
future) datetime value as the first item and its
formatted string as the second item. The biggest
loss would be performance, but not too much of it.

Add your own comment.