Order by the number
in descending order and return only one record with limit
select title
from your_table
order by number desc
limit 1
Question
So basically I have a table with two fields, 'number' and 'title', and I need a query to select the row with the highest value in 'number', for this i used
SELECT MAX('number') FROM table
Now I need to get the value of 'title' that corresponds to the highest value of 'number'.
How can this be achieved?
Solution
Order by the number
in descending order and return only one record with limit
select title
from your_table
order by number desc
limit 1
OTHER TIPS
select title, number from table where number=(select max(number) from table);