hi, i hav one simple but ?? problem..can any one tell me how to fetch first 10 or last 20 rows from a table which contains 100 records... thanx in advance...
Remar Uy
Ranch Hand
Joined: Mar 18, 2002
Posts: 35
posted
0
select * from emp where rownum < 11 /
sumit malik
Greenhorn
Joined: Oct 31, 2001
Posts: 21
posted
0
Originally posted by Remar Uy: select * from emp where rownum < 11 /
thanx...but i think this is not a proper solution ...i guess there r some functions like TOP to fetch rows...and how can i fetch last 40 rows ..using this method..
Lipman Li
Ranch Hand
Joined: May 02, 2002
Posts: 122
posted
0
select * from (select * from emp order by rownum desc) where rownum < 41; you'll get the last 40 records.
SJ Adnams
Ranch Hand
Joined: Sep 28, 2001
Posts: 925
posted
0
select name from (select rownum a, name from emp ) where a > 60 ?
Remar Uy
Ranch Hand
Joined: Mar 18, 2002
Posts: 35
posted
0
Hi, If you're using 8.1.7 and above, you can use Rank. Hth.