I want to get values from a row with the largest certain value (in this example, the oldest member)
Select * from members where age=max(age)
Will this work?
And what will happen if there is more than 1 oldest members with the same age?
(I don’t have to worry about it because I use auto_increment, but I just got curious)
Thanks.
If there are more than 1 member with the same maximum age, you will get multiple results. To select just one from that:
You can optionally add an
order byif you favor any particular data over a random one.