This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes display only 2 rows from a recordset size of 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "display only 2 rows from a recordset size of 10" Watch "display only 2 rows from a recordset size of 10" New topic
Author

display only 2 rows from a recordset size of 10

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
I have a requirement like this:
I have a holiday definiton table and a holiday dates table.

For a given holiday definition, there can be multiple holiday dates. so, based on the seq no, i get to get all the holiday definitons and all the dates for each holiday definition.

From this recordset, i need to fetch the holiday dates, get the biggest of those dates and display only 1 row for each holiday definition on the view with the largest date. How do I manipulate the resultset?

Any help!


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

The best way to to only fetch the records you want in the first pace. You may be able to do this with a simple where clause. If not, some database systems allow you to limit the returned data to a "slice" of the results. For example, PostgreSQL has the LIMIT and OFFSET keywords to do this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: display only 2 rows from a recordset size of 10
 
Similar Threads
Getting meta data from an Entity bean
The Date of Easter
Display Data ,get it from two Tables
Recordset Get Fields
why rowset exhausted error coming?