我如何在 Oracle 中获得前 1 名?

2022-01-30 00:00:00 sql oracle11g oracle sql-limit

How do I do the following?

select top 1 Fname from MyTbl

In Oracle 11g?

解决方案

If you want just a first selected row, you can:

select fname from MyTbl where rownum = 1

You can also use analytic functions to order and take the top x:

select max(fname) over (rank() order by some_factor) from MyTbl

相关文章