aspose file tools*
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
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: 61658
    
  67

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]
 
 
subject: display only 2 rows from a recordset size of 10