Consider these two queries:
SELECT *, MAX(age) AS maxAge FROM someTable ORDER BY age ASC;
SELECT *, 'dummyC' AS dummyC FROM someTable ORDER BY age ASC;
The former query returns all rows and all columns of the table, plus an additional dummy column. The later query returns only a single row, that row which has the lowest primary key. Why is that, and how can I work around it? Tested in MySQL 5.1 on some old but stable Debian server.
This is a MySQL extension.
The value you get is indeterminate. You will often get the first row that was inserted into the table, but this is not guaranteed.
If you want the corresponding values from the row containing the highest age then it is better to use a combination of
ORDER BYandLIMIT 1: