Follow us on Social Media:

MySQL Database Administrator

Boost Your Quick Knowledge in MySQL DBA Work, Concepts, Tips and Trick

Thursday, 19 April 2018

How to Select Nth highest marks/Value in Column ?

MySQL Select Query for Nth highest Value

​SELECT * from test.test where marks= (SELECT distinct (marks) FROM test.test order by marks desc limit (n-1),1);​

​We have following table..

Now we have to select 3rd highest Marks in table "test"

Query and it's result is showing below..

SELECT  * from test.test where marks= (SELECT distinct (marks) FROM test.test order by marks desc limit 2,1);


 

No comments:

Please Like and Subscribe us ....

Please visit the website on daily basis , Your New articles will publish at any moment. Please Subscribe us for getting Latest Updates...