Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Fetch rec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
lakshmibala

New User


Joined: 16 Jun 2004
Posts: 47

PostPosted: Thu Sep 30, 2004 6:08 pm    Post subject: Fetch rec
Reply with quote

Hi all,

i have a doubet can v retrieve rows frm middle of a table i.e frm 100 to 125 , how is it possible?

Regards
Lakshmi
Back to top
View user's profile Send private message
References
PostPosted: Thu Sep 30, 2004 6:08 pm    Post subject: Re: Fetch rec Reply with quote

ConnoisseuR

New User


Joined: 06 Aug 2004
Posts: 8
Location: india

PostPosted: Tue Oct 05, 2004 9:20 am    Post subject: FETCH REC
Reply with quote

Each row in the TABLE is provided with an unique id i.e. TABLE ID.
you can put a simple select query like this:

SELECT *
FROM TABLE_NAME
WHER TABLE_ID BETWEEN 100 AND 500;

Thanks
santosh
Back to top
View user's profile Send private message
lakshmibala

New User


Joined: 16 Jun 2004
Posts: 47

PostPosted: Wed Oct 06, 2004 8:15 pm    Post subject: Fetch
Reply with quote

HI,

u said the range from 100 to 500, but i am asking 100th row from 500th row ok, r u under stand my question,

regrds
Lakshmi
Back to top
View user's profile Send private message
sandip_datta

EXPERT


Joined: 02 Dec 2003
Posts: 152
Location: Tokyo, Japan

PostPosted: Thu Oct 07, 2004 9:03 am    Post subject:
Reply with quote

Lakshmi,

I am really confused about the sentence structure of your last post. May be I don't know that much good english. Can you please put some verb in the sentence in proper place and let us know what actually do you want?

Regards,
Sandip.
Back to top
View user's profile Send private message
anuradha

Global Moderator


Joined: 06 Jan 2004
Posts: 257

PostPosted: Fri Oct 08, 2004 2:00 pm    Post subject:
Reply with quote

Hi Lakshmi,

Quote:
u said the range from 100 to 500, but i am asking 100th row from 500th row ok, r u under stand my question


Do u want the rows from 100 to 500 or what?

If Yes then just modify the query given by santosh accordingly.

SELECT *
FROM TABLE_NAME
WHER TABLE_ID BETWEEN 99 AND 501

So,I hope this will fetch the rows from 100 to 500.

Thanks,
Anu
Back to top
View user's profile Send private message
ConnoisseuR

New User


Joined: 06 Aug 2004
Posts: 8
Location: india

PostPosted: Tue Oct 12, 2004 12:19 pm    Post subject:
Reply with quote

hi lakshmi , i got your problem.this can be done by FETCH FIRST N ROWS

QUERY WILL BE LIKE THIS

SELECT *
FROM TABLE_NAME
WHERE TABLE_ID = 500
FETCH FIRST 100 ROWS ONLY


hope this makes it clear now.


santosh
Back to top
View user's profile Send private message
ConnoisseuR

New User


Joined: 06 Aug 2004
Posts: 8
Location: india

PostPosted: Tue Oct 12, 2004 12:30 pm    Post subject:
Reply with quote

hi anuradha,
i would like to correct you that BETWEEN implies including both the boundaries.

so if we write

select *
from table
where field between 100 and 500

this query will process the records including the 100th and 500th.


santosh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1