If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to select the top 10 rows from a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-08, 11:29
KevinYC KevinYC is offline
Registered User
 
Join Date: Aug 2008
Posts: 42
How to select the top 10 rows from a table

Hello all,

I know you can select the top 10 records from a table in SQL server with the following:

select top 10 *
from tb123

Is there a similar command in DB2?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 11-13-08, 12:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
select * from tb123 fetch first 10 rows only

Andy
Reply With Quote
  #3 (permalink)  
Old 11-13-08, 12:54
madhu_kaza madhu_kaza is offline
Registered User
 
Join Date: Apr 2008
Posts: 39
SELECT * FROM <table name>
FETCH FIRST N ROWS ONLY


Thanks
Madhavi.
Reply With Quote
  #4 (permalink)  
Old 11-13-08, 14:38
KevinYC KevinYC is offline
Registered User
 
Join Date: Aug 2008
Posts: 42
Thank you both !
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On