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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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