not all db's have the ability to select via rownum. For such a db the query below can be modified as follows:
SELECT * FROM tablename t1 WHERE (select count(*) from tablename t2 where t2.salary > t1.salary) < 5 ORDER BY t1.salary > -----Original Message----- > From: Vishal Chaddha [SMTP:[EMAIL PROTECTED] > Sent: 03 June 2003 02:56 > To: [EMAIL PROTECTED] > Subject: Re: displaying 5th record > > Hi Priti, > > You can execute following query from your JSP > > Select Salary from tablename where rownum<=5 order by salary desc; > > This will first arrange records in descending order of Salary and then > limit > the count of records to 5. Data in first Record fetched would be highest > among thee five records. > > Hope this helps. > Vishal > > -----Original Message----- > From: A mailing list about Java Server Pages specification and reference > [mailto:[EMAIL PROTECTED] Behalf Of Priti Chhetri > Sent: Tuesday, June 03, 2003 4:23 PM > To: [EMAIL PROTECTED] > Subject: displaying 5th record > > > Hi All, > > I need to take out last 5 records from the table and without using any > condition and then I have display highest salary from retrieved Records in > JSP as I have one column as Salary .(using Oracle ).Quick answer would be > very much helpful > > > > thanks > Priti > > ========================= > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > http://java.sun.com/products/jsp > http://archives.java.sun.com/jsp-interest.html > http://forums.java.sun.com > http://www.jspinsider.com > > ========================================================================== > = > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > > Some relevant archives, FAQs and Forums on JSPs can be found at: > > http://java.sun.com/products/jsp > http://archives.java.sun.com/jsp-interest.html > http://forums.java.sun.com > http://www.jspinsider.com -- It is the strict policy of Truworths that its e-mail facility and all e-mail communications emanating therefrom, should be utilised for business purposes only and should conform to high professional and business standards. Truworths has stipulated certain regulations in terms whereof strict guidelines relating to the use and content of e-mail communications are laid down. The use of the Truworths e-mail facility is not permitted for the distribution of chain letters or offensive mail of any nature whatsoever. Truworths hereby distances itself from and accepts no liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for other than strictly business purposes. Truworths furthermore disclaims liability for any unauthorised instruction for which permission was not granted. Truworths Limited accepts no liability for any consequences arising from or as a result of reliance on this message unless it is in respect of bona fide Truworths business for which proper authorisation has been granted. Any recipient of an unacceptable communication, a chain letter or offensive material of any nature is requested to notify the Truworths e-mail administrator ([EMAIL PROTECTED]) immediately in order that appropriate action can be taken against the individual concerned. =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com
