If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Simple queries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-06, 05:39
muhammadowais muhammadowais is offline
Registered User
 
Join Date: May 2006
Posts: 1
DB2 Simple queries

Hello;

* Can anybody help me in writing a simple query to get data ranging from record # 50 to record # 75 in the query below:

SELECT * FROM DB2ADMIN.ST_ITEM

* Also how to generate unique id for primary key.

Thanking you in an advance


With Regards

Muhammad Owais Bilal Awan
Reply With Quote
  #2 (permalink)  
Old 05-04-06, 05:52
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
with temp(rid,col1,col2)
as
(
select rownumber() over () ,col1,col2 from DB2ADMIN.ST_ITEM fetch first 75 rows only
)
select * from temp where rid between 50 and 75
is one option

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On