473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retruning the first five rows of a query statement result

Hi,
Is there a way to display just the first five rows of the query stt
result in DB2. I know that there is something called select Top 5 *
from tablename in SQL Server 2000. Is there a wayaround, if there are
no stts in DB2, ie if we can use two or three DB2 sql stts to achieve
this result.
-Thanks
Kangan
Nov 12 '05 #1
3 25533
select * from address order by name fetch first 5 rows only

Kangan wrote:
Hi,
Is there a way to display just the first five rows of the query stt
result in DB2. I know that there is something called select Top 5 *
from tablename in SQL Server 2000. Is there a wayaround, if there are
no stts in DB2, ie if we can use two or three DB2 sql stts to achieve
this result.
-Thanks
Kangan


Nov 12 '05 #2
Try: select .... from table .... fetch first 5 rows only
HTH, Pierre.

Kangan wrote:
Hi,
Is there a way to display just the first five rows of the query stt
result in DB2. I know that there is something called select Top 5 *
from tablename in SQL Server 2000. Is there a wayaround, if there are
no stts in DB2, ie if we can use two or three DB2 sql stts to achieve
this result.
-Thanks
Kangan


--
Pierre Saint-Jacques
IBM DB2 Cerified Solutions Expert - Administration
SES Consultants Inc.

Nov 12 '05 #3
Kangan,
feature is there in db2

select col1,col2,....
from tab1
where col1 = ?
fetch first 5 rows only

that will give only 5 rows
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: NotGiven | last post by:
I need to build a query based on what the user checks in the form. For example, if the user does not check certain fields, I don' tneed to use those in the query statement. Any ideas how to...
4
by: George Stout | last post by:
First off I do not know alot about writing queries to an Access Database from an ASP page. This is why I need help. I have an Events database for 6 colleges in our metro area. On the homepage I...
0
by: lowellturner | last post by:
We recently had to reload an app to a Linux server from its Window counterpart. I've tried setting the lower case global in my.cnf to al three values, but none work. Previously, this worked fine....
8
by: Evan Smith | last post by:
During a routine performance check using an event monitor, I discovered a class of query whose performance has me baffled. The monitor captured: SELECT * FROM EWM_CASE fetch first 1 rows only...
3
by: hmiller | last post by:
I have created and IIF statement in an unbound text box. The IIF statement produces a text result, ie "On Time", in the unbound text box. What I would like to do is reffence this text box and then...
3
by: BulbFresh | last post by:
Hi, I'm using Access 2000 and importing .csv files to a table. This works very well apart from one column which sometimes will be a short note (text < 255 characters) and sometimes a long...
2
by: HowHow | last post by:
Using Access 2000, normally query returns result horizontally. Is there any way to set the query to return result vertically? For example, my query shown the result as below: Heading ...
6
by: simonyong | last post by:
1. select * from MyDataBase 2. select count(*)as total_child,direct_mngr_personnel_number as personnel_number from MyDataBase group by direct_mngr_personnel_number both of the query statement is...
2
by: deshaipet | last post by:
Hi Folks, I would like to update only first 1000 rows of a table. Can anyone help me with the SQL ? Thanks, Panditt
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.