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
 
How to display last 3 records of a table

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

New User


Joined: 21 Feb 2005
Posts: 6
Location: India

PostPosted: Sat Feb 26, 2005 7:02 pm    Post subject: How to display last 3 records of a table
Reply with quote

hi Friends,

Have A Nice Day To All.

I am Rajesh here.Again i am having one doubt in db2.can any one please help me.


1. In a table , there are 25 records .Its not in the order.I want to display the last three records as it is in the table. Don't want to sort.how to write a query for this ?.

Like that i want to select only one record from the table without using conditions(ie, not using coloumn name).how to write query for this?


regards,
R.Rajesh.
Back to top
View user's profile Send private message

priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Mon Feb 28, 2005 10:54 pm    Post subject: Re
Reply with quote

Raj,

Why not you try Cursors with "FOR FETCH LAST 3 ROWS ONLY" option.
Back to top
View user's profile Send private message
rajkan24

New User


Joined: 21 Feb 2005
Posts: 6
Location: India

PostPosted: Tue Mar 01, 2005 7:19 pm    Post subject: hi freinds
Reply with quote

Hi friends ,

"Have A Nice Day"

Thanks for your reply.is there any other method to select the records?.If yes please reply.


Can anyone tell what is row-no() function?. how can we use this?.please reply.bye.

Regards,
R.Rajesh.
Back to top
View user's profile Send private message
sivatechdrive

Active User


Joined: 17 Oct 2004
Posts: 190
Location: hyderabad

PostPosted: Wed Mar 02, 2005 1:41 pm    Post subject:
Reply with quote

hi rajesh

Even though the row number function is available with Oracle it is not available with normal DB2 ,but
The function is available with DB2 UDB.

the format will be
ROW_NUMBER() OVER (ORDER BY column DESC)

if only ROW_NUMBER() is given
then the result is System Dependent


Thanks
Siva
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 Skip records depends on count lakshmiibmmainframes DFSORT/ICETOOL 5 Sun Dec 24, 2017 9:51 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 9 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am

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