Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need SQL to read only the last record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
maheshurstd

New User


Joined: 16 Feb 2006
Posts: 14

PostPosted: Mon Jun 26, 2006 12:15 pm    Post subject: Need SQL to read only the last record
Reply with quote

Hi,

How to read only the last record without having a record key values using SQL? &

How to read only the First record without having a record key values?

If any one has the code please send it

Thanks in advance

Regards

Mahesh
Back to top
View user's profile Send private message

Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Mon Jun 26, 2006 12:33 pm    Post subject: Re: Need SQL to read only the last record
Reply with quote

I am not sure what exactly u need..

If u want to select only first row from a set of rows retrived..u can very well give FETCH FIRST ROW ONLY statement in DB2 like

select * from table
FETCH FIRST ROW ONLY ;

To get the last row may be, u can use an order by clause to reverse order the row retrival and try a fetch first row.. icon_rolleyes.gif

Please correct me if I am wrong..
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us