1

my table look like this..

id name count
-- ---- -----
1 Mike 0
2 Duke 2
3 Smith 1
4 Dave 6
5 Rich 3
6 Rozie 8
7 Romeo 0
8 Khan 1
----------------------

I want to select rows with max(count) limit 5 (TOP 5 Names with maximum count)

that would look sumthing like...

id name count
-- ---- -----
6 Rozie 8
4 Dave 6
5 Rich 3
2 Duke 2
3 Smith 1

please help,,

thanks

1
  • WHAT database system are you using?? Some things are dependent on the product used.... Commented Oct 14, 2010 at 6:10

1 Answer 1

1

Here is how:

MySQL:

SELECT * FROM tableName ORDER BY count DESC LIMIT 5

MS SQL:

SELECT TOP 5 * FROM tableName ORDER BY count DESC
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.