bahoz99
bahoz99

Reputation: 121

Selecting Top 2 Values Using MySQL

id name
1 ali
2 jack
3 rex
4 henry
5 clark

i have this table. I need select top 2 values without knowing Which id belongs to which name.

id name
4 henry
5 clark

Upvotes: 1

Views: 189

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270873

Do you just want order by and limit?

select t.*
from t
order by id desc
limit 2;

Upvotes: 1

Related Questions