This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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: 61310
    
  66

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