This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes SQL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL question" Watch "SQL question" New topic
Author

SQL question

shalu sharma
Ranch Hand

Joined: Sep 09, 2002
Posts: 51
Hi,

I am new to db2, I have a certain requirement where i have to select top 10 values from a table. please help me how it can be acheived. if any body knows a good book on db2 online then pls share the link with me

TIA
Shalu
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
Hi,
For fetching the top 10 values you can use the same normal sql query and simply append the following at the end of your query

FETCH FIRST 10 ROWS ONLY

ie select column_name from table FETCH FIRST 10 ROWS ONLY

cheers,
Raj
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: SQL question
 
It's not a secret anymore!