How to find out the second largest element from mysql table
Answers were Sorted based on User's Feedback
Answer / laxmanit08
select final_id from care_billing_final order by final_id
desc limit 1,1;
| Is This Answer Correct ? | 49 Yes | 14 No |
Answer / nikhil mishra
SELECT Salary FROM tablename order by Salary desc limit 1,1
| Is This Answer Correct ? | 24 Yes | 11 No |
select marks from tbl_data where marks<(select max(marks)
from tbl_data) order by marks desc limit 1;
| Is This Answer Correct ? | 21 Yes | 11 No |
Answer / prasadkonnur
select id from tbl_name order by id desc limit(0,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 ? | 13 Yes | 10 No |
Answer / deo ram yadav
select BranchName
from Account
order by Balance desc limit 1, 1;
Note: ,BranchName' is attribute and 'Account' is table. 1,1 means leave one row and then take another one row.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / md aftab alam
select distinct final_id from care_billing_final order by final_id
desc limit 1,1;
| Is This Answer Correct ? | 2 Yes | 1 No |
select salary from tableName group by salary order by
salary limit 2,1
| Is This Answer Correct ? | 10 Yes | 10 No |
Answer / salil
SELECT max( t1.col )
FROM `table` t1
WHERE t1.col < (SELECT max( t2.col ) FROM `table` t2);
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / prashant chaudhary
select name,marks from Student_Info where marks = (select
max(marks) from Student_Info where marks <
(select max(marks)from Student_Info ))
| Is This Answer Correct ? | 4 Yes | 4 No |
How we can see all indexes defined for a table in mysql?
What is difference between schema and table?
What is sql in mysql?
How to update info already in a table and delete a row(s) from a table.
What is mysql and why it is used?
i made a table in sql server 2000 and in a column i want to add image path of a picture present in my hardisk... so using insert statement how will i insert the path of the image in the table??
how we can find nth max salary from an employe table by using my sql?
What is difference between oracle and mysql?
What are the features of Stored Procedures in MYSQL?
what is database black box testing? : Mysql dba
What are mysql queries?
What is data directory in mysql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)