Link to home
Start Free TrialLog in
Avatar of Lennart Ericson
Lennart EricsonFlag for Sweden

asked on

How to find second lowest, third lowest, ...nth lowest value in a MySQL column

Given this database table:

id         name             mark

1          John Deo         75
2          Max Ruin         85
3          Arnold             55
4          Krish Star        60

I'd like to find second lowest and third lowest
Searching the net I found a Query string andd tried it:

$SQL2 = "SELECT DISTINCT(name), id FROM table ORDER BY id DESC LIMIT 2, 1 ";
It failed.

Please, experts, could you lead me through this? Incidentally, at the end of the line its states "limit 2, 1". I wonder what ",1" is for. Should appreciate an explanation.
ASKER CERTIFIED SOLUTION
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lennart Ericson

ASKER

Thanks!