Use a subquery if you want to allow for multiple titles sharing the same maximum value:
select title from table where value = (select max(value) from table);
EDIT: As to your own query:
You aggregate all rows to a single one by asking for the MAX(value)
without a GROUP BY
clause. But then you select title
. Which? You don't tell the DBMS and so the query is actually invalid SQL. MySQL, however, lets this slip and silently applies ANY_VALUE
on title
, which is not what you want. You want a particular one.
There is another flaw in your query: In HAVING MAX(value)
you have no comparison (like in HAVING MAX(value) > 1000
for instance). But the DBMS expects an expression with a boolean result (true or false or null). Your expression should ideally raise an error, but MySQL simply converts the value to boolean with false = 0, true <> 0. 68565 is not zero, so the condition is true.
So you end up with a single row holding an arbitrarily picked title.