hi
how to do this: select top 1 Fname from MyTbl
in oracle 11g ?
thank's in advance
hi
how to do this: select top 1 Fname from MyTbl
in oracle 11g ?
thank's in advance
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
SELECT *
FROM (SELECT * FROM MyTbl ORDER BY Fname )
WHERE ROWNUM = 1;
Use:
SELECT x.*
FROM (SELECT fname
FROM MyTbl) x
WHERE ROWNUM = 1
If using Oracle9i+, you could look at using analytic functions like ROW_NUMBER() but they won't perform as well as ROWNUM.