ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How do I find second highest value from a table?

user-image
تم إضافة السؤال من قبل Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
تاريخ النشر: 2012/12/30
Hazem Qannash
من قبل 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.

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

Mostafa Shamout
من قبل 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
من قبل marwa khalaf , .Net Developer , Sands National Academy

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

nithin koshy
من قبل nithin koshy , Database administrator -INTERN , Syncron

SELECT TOP 2 FROM TABLE

ORDER BY <COLUMN_NAME> DESC;

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟