IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need SQL to read only the last record


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top