Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

sql Select the Nth Highest value from a table?

Highest Nth select sql Table value
0
Posted

sql Select the Nth Highest value from a table?

0

select level, max(‘col_name’) from my_table where level = ‘&n’ connect by prior (‘col_name’) > ‘col_name’) group by level; Example: Given a table called emp with the following columns: — id number — name varchar2(20) — sal number — — For the second highest salary: — select level, max(sal) from emp — where level=2 — connect by prior sal > sal — group by level

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.