If I have a USER table like
class | age
--------------
1 20
3 56
2 11
1 12
2 20
Then I can easily get the youngest user in each class via
select class, min(age)
from user
group by class;
Similarly, by replacing min with max, I can get the oldest. But how can I get the 10th youngest (or oldest) in each class? By the way, I'm using MySql v.5.0.
Cheers,
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…