How to find out the second largest element from mysql table

Answer Posted / prasad

select id from tbl_name order by id desc limit(1,1)

(selects 2nd highest id)

for nth highest

select id from tbl_name order by id desc limit(n-1,1)

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is row locking in mysql?

604


What is the purpose of using timestamp data type?

579


What happens if null values are involved in expressions?

659


How do I make an action query?

564


Do while loop in mysql procedure?

648






How do I set user privileges in mysql?

553


How to copy data from one server to another using php?

629


Are stored procedures precompiled?

600


How are mysql timestamps seen to a user?

575


How do I export mysql query results to excel?

599


How can we optimize stored procedure?

572


If we use sum function in mysql, does it return sum of that row or for that column?

607


What is the difference between sql and mysql and oracle?

525


How do I kill a mysql connection?

554


What is mysql optimization?

558