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

Retriving frist N rows from a select in DB2 V6


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
thiagold

New User


Joined: 29 Nov 2005
Posts: 3

PostPosted: Wed Nov 30, 2005 4:24 pm
Reply with quote

Im trying to retrive N rows from a select, but in DB2 version 6. It not alowed to use the "FETCH FIRST N ROWS ONLY" sintax and it do not recognize the ROWID or ROW_NUMBER() columns ou functions. I need do this in one SQL request. Another case is that should run without using any PK or similars. Example:

SQL Server: "SELECT TOP N * FROM (select * from table_a)"

Oracle: "SELECT * FROM (select * from table_a) ta WHERE ta.rownum <= N

Best regards
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Dec 02, 2005 4:48 am
Reply with quote

icon_cry.gif This was always a problem before V7. I think you are out of luck on this one.

Anyone have any suggestions? icon_question.gif

If you find the solution, Please post it.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Dec 02, 2005 11:24 am
Reply with quote

Hi frnd,

Whether ur shop wont update the versions r not??? bcz v r not clear with ur requirement... so without that RowNum,Fetch facility the only way is Primary key.. u too locked that.. then how my frnd..?????
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 To get the count of rows for every 1 ... DB2 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top