Take the emp table as an example Select rownum, empno from emp where rownum < ( Select count(*) + 1 from emp) minus Select rownum, empno from emp where rownum < ( Select (count(*) + 1) - 10 from emp)
Hope this works Fazal --- Amjad Saiyed <[EMAIL PROTECTED]> wrote: > hi milind > > iam not sure but does <= will work coz with rownum > i thought > only < worked.....hence we could use "< 11" > i not sure can u let me know ... > > thanx and rgds, > Ams.... > > -----Original Message----- > Sent: Wednesday, August 14, 2002 7:13 PM > To: Multiple recipients of list ORACLE-L > > > Hi Santosh, > > If I understand your requirement correctly, this > could be the solution > > for first 10 records : > select * from TABLE_NAME where rownum<=10 order by > rowid; > for last 10 records : > select * from contract where rownum<=10 order by > rowid desc; > > MILIND SHITOLE > [EMAIL PROTECTED] > > > >From: "Amjad Saiyed" <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: Multiple recipients of list ORACLE-L > <[EMAIL PROTECTED]> > >Subject: RE: Finding out last 10 records > >Date: Wed, 14 Aug 2002 04:28:24 -0800 > > > >i thought santosh wanted records based on value > that is 1st 10 minimal > >values and last 10 max values...well if this is not > the case than the > >solution that i had send using rownum is obsolete > and hence ignore it.... > > > >rgds, > >Ams. > >www.medicomsoft.com. > > -----Original Message----- > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Alexandre > >Gorbatchev > > Sent: Wednesday, August 14, 2002 3:08 PM > > To: Multiple recipients of list ORACLE-L > > Subject: Re: Finding out last 10 records > > > > > > Santosh, > > > > There is no "last" and "first" records in > relational databases in terms > >of > >location. All records are equal and may be stored > physically anywhere. I > >guess that may be possible (parsing ROWID and using > information about > >extent > >location) to sort records by extent, block and > number of record inside > >block, but that's not a trivial task. > > If you need to select last 10 inserted records, > make a trigger with > >filling a timestamp into a column and select with > sort by this column using > >rownum in where condition. > > > > Alexandre > > ----- Original Message ----- > > From: Santosh Varma > > To: Multiple recipients of list ORACLE-L > > Sent: Wednesday, August 14, 2002 11:48 AM > > Subject: Finding out last 10 records > > > > > > Hello all > > Could any one of you guide me on how to > select last 10 records > >from > >a table. and also finding out first 10 records.. > > > > Thanks and regards, > > > > Santosh > > > > > > > > > _________________________________________________________________ > Join the world’s largest e-mail service with MSN > Hotmail. > http://www.hotmail.com > > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.com > -- > Author: Milind Desh > INET: [EMAIL PROTECTED] > > Fat City Network Services -- (858) 538-5051 FAX: > (858) 538-5051 > San Diego, California -- Public Internet > access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). > > > -- > Please see the official ORACLE-L FAQ: > http://www.orafaq.com > -- > Author: Amjad Saiyed > INET: [EMAIL PROTECTED] > > Fat City Network Services -- (858) 538-5051 FAX: > (858) 538-5051 > San Diego, California -- Public Internet > access / Mailing Lists > -------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an > E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of > 'ListGuru') and in > the message BODY, include a line containing: UNSUB > ORACLE-L > (or the name of mailing list you want to be removed > from). You may > also send the HELP command for other information > (like subscribing). ===== Abul Fazal Production Support Services - Quantum Leap Standard Charted Bank Singapore HP : 65-94887900 __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Abul Fazal INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).