View previous topic :: View next topic
|
Author |
Message |
rajkan24
New User
Joined: 21 Feb 2005 Posts: 6 Location: India
|
|
|
|
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 |
|
|
priya
Moderator
Joined: 24 Jul 2003 Posts: 568 Location: Bangalore
|
|
|
|
Raj,
Why not you try Cursors with "FOR FETCH LAST 3 ROWS ONLY" option. |
|
Back to top |
|
|
rajkan24
New User
Joined: 21 Feb 2005 Posts: 6 Location: India
|
|
|
|
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 |
|
|
sivatechdrive
Active User
Joined: 17 Oct 2004 Posts: 191 Location: hyderabad
|
|
|
|
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 |
|
|
|