Hi, I think following logic is simpler than the Raju's
int max1 = 0, max2 = 0, max3 = 0; while (there are more no's in the database) { n = extract_next_number_from_db(); if (n > max1) { if (n > max2) { if (n > max3) { max1 = max2; max2 = max3; max3 = n; } else { max1 = max2; max2 = n; } } else { max1 = n; } } } result: max3 > max2 > max1 regards -----Original Message----- From: Peter [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 5:39 PM To: [EMAIL PROTECTED] Subject: Re: Top 3 thanks for all who shared the comments on my question Dear Mr Raju BSN .. i was looking for exactly the same solution u suggested thanks a lot Best Regards Peter ----- Original Message ----- From: "Raju BSN" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 29, 2003 5:24 PM Subject: Re: Top 3 > Hi, > > Try the following sample logic if you are not able to get it done in the SQL > Query it self... > > int top1 = 0; > int top2 = 0; > int top3 = 0; > > int resultsetData = 0; > > > While(resultset.next()) { > > resultsetData = resultset.getXXX("column_name"); > > if(resultsetData > top1) { > if(top2 < top1) { > if(top3 < top2) { > top3 = top2; > } > top2 = top1; > } > top1 = resultsetData; > } > if(resultsetData < top1 && resultsetData > top2) { > if(top3 < top2) { > top3 = top2; > } > top2 = resultsetData; > } > if(resultsetData < top1 && resultsetData < top2 && resultsetData > top3 ) { > top3 = resultsetData; > } > > } > > Hope this will help > > Regards > Raju > > > > ----- Original Message ----- > From: "Pradeep Kumar" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, July 29, 2003 4:33 PM > > > > Use a query like this: > > > > select max(emp_id) from employee where emp_id <>(select max(emp_id) from > > employee) > > > > -----Original Message----- > > From: Lakshmeenarayana [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 29, 2003 4:32 PM > > To: [EMAIL PROTECTED] > > Subject: > > > > put them in integer array and use Arrays.sort(int[] arr) method. > > > > > > > > -----Original Message----- > > From: A mailing list about Java Server Pages specification and reference > > [mailto:[EMAIL PROTECTED] Behalf Of Peter > > Sent: Tuesday, July 29, 2003 3:48 PM > > To: [EMAIL PROTECTED] > > Subject: > > > > > > hi i need a misc..hlp > > this is no way related to this group but still i put this question..since > i > > know this group has elite personalities with logical brain.. > > assume there is a series of nos is 3,4,5,6,7,9 > > the nos are from data base .. i want the maximum three nos in a three > > variables .. > > any java code will be helpful > > no arrays please.. > > > > Best Regards > > Peter > > > > ========================= > > 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 > > > > > > > > DISCLAIMER: > > This message (including attachment if any) is confidential and may be > privileged. Before opening attachments please check them for viruses and > defects. MindTree Consulting Private Limited (MindTree) will not be > responsible for any viruses or defects or any forwarded attachments > emanating either from within MindTree or outside. If you have received this > message by mistake please notify the sender by return e-mail and delete > this message from your system. Any unauthorized use or dissemination of this > message in whole or in part is strictly prohibited. Please note that > e-mails are susceptible to change and MindTree shall not be liable for any > improper, untimely or incomplete transmission. > > > > 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 > =========================================================================== 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