1

I have a table records with one column value, and I have 10 records in it like,

10,2,5,6,9,4,1,7,8,3. I want to get two maximum or highest values eg. 9 and 10, what will be the query?

0

2 Answers 2

3

This will do it

SELECT value
  FROM records
 ORDER BY value DESC
 LIMIT 2

Output:

| VALUE |
|-------|
|    10 |
|     9 |

Here is SQLFiddle demo

2
  • I got the answer , thnx
    – zniz
    Sep 1, 2013 at 8:35
  • @zniz You're quite welcome. Good luck ;)
    – peterm
    Sep 1, 2013 at 8:38
3
Select * 
from records 
order by value desc 
limit 2
1
  • I got the answer , thnx
    – zniz
    Sep 1, 2013 at 8:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.