Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Fetch rec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
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

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

Active User


Joined: 02 Dec 2003
Posts: 151
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

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts JCL to fetch schedule status from act... parasmalik20 CA Products 1 Thu Jun 02, 2016 7:11 pm
No new posts ABEND due to FETCH FAILED jackzhang75 ABENDS & Debugging 17 Thu Mar 10, 2016 3:08 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us