Joe Slater
Joe Slater

Reputation: 2473

How to retrieve top 10 entries?

I have a MySQL table which looks like this - Description

I now want to retrieve top 10 athleteName based on the time. I know I can use top clause, but that returns the entries based on the top 10 ids. How can I retrieve the entries based on the time. I want to get the athletes with top 10 record times.

What is the correct SQL statement for this?

Upvotes: 0

Views: 77

Answers (4)

echo_Me
echo_Me

Reputation: 37243

try this

 select max(`time`) ,atheletename from table order by atheletename limit 10 DESC

Upvotes: 0

Adriano Carneiro
Adriano Carneiro

Reputation: 58665

select *
from yourtable
order by time desc
limit 10

Upvotes: 1

Sudipta Chatterjee
Sudipta Chatterjee

Reputation: 4670

select * from scores order by time desc limit 0,10

Upvotes: 1

Jesus Ramos
Jesus Ramos

Reputation: 23266

select atheletename from table order by time limit 0,10

Upvotes: 3

Related Questions