MySQL - how do you get the n greatest values? Let's say I have a table:
name age
Alice 3
Bob 6
Carol 9
Daniel 4
Let us say I wanted to return the two rows with the two greatest ages. Is there a way to do this? My list will eventually be much greater than 4 people, and I will eventually want to find much more than just the 2 oldest people, so I don't want to have to manually do it.
I am using MySQL with PHP. |