Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How do I find second highest value from a table?

user-image
Question ajoutée par Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date de publication: 2012/12/30
Hazem Qannash
par Hazem Qannash , Technical Team Leader , Bayt.com

You can use this query: select distinct points from table order by points desc offset 1 limit 1; to return the second highest value from the table.

Utilisateur supprimé
par Utilisateur supprimé

I think this is the most straight forward solution..
SELECT MAX( col ) FROM table WHERE col < ( SELECT MAX( col ) FROM table )

Mostafa Shamout
par Mostafa Shamout , Web Designer , Freelance

SELECT salary_amount FROM (select salary2.*, rownum rnum from (select * from salary ORDER BY salary_amount DESC) salary2 where rownum = 2;

marwa khalaf
par marwa khalaf , .Net Developer , Sands National Academy

You can write as following : select min(ID) from Table limit 2

nithin koshy
par nithin koshy , Database administrator -INTERN , Syncron

SELECT TOP 2 FROM TABLE

ORDER BY <COLUMN_NAME> DESC;

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?