MC Press Online Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottom Post Reply Favoured: 0
TOPIC: iSeries SQL
#74150
J.Pluta (User)
Platinum Boarder
Posts: 2712
graphgraph
User Offline Click here to see the profile of this user
iSeries SQL 1 Year, 10 Months ago Karma: 0  
SELECT FIRST is not ANSI standard (nor is TOP). The standard, which DB2 supports just fine on the oldest machine I have (V5R1), is FETCH FIRST n ROWS, as in: <p>SELECT utyp03, team03 FROM use03 WHERE envn03 = 'ECO' FETCH FIRST 1 ROWS ONLY <p>I know this may seem a little uncouth grammatically when only fetching a single row, so you can also use the following: <p>SELECT utyp03, team03 FROM use03 WHERE envn03 = 'ECO' FETCH FIRST ROW ONLY <p>Joe
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#74151
kitvb1 (User)
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
iSeries SQL 1 Year, 10 Months ago Karma: 0  
Hi Joe, <BR>
Thanks... it works... <p>Regards <p>Kit
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#74152
mscottx (User)
Fresh Boarder
Posts: 18
graphgraph
User Offline Click here to see the profile of this user
iSeries SQL 1 Year, 9 Months ago Karma: 0  
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#74149
kitvb1 (User)
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
iSeries SQL 1 Year, 9 Months ago Karma: 0  
Hi All <BR>
Does anyone know if IBM have yet included the FIRST function in their SQL? I have v5r2 and it appears that it is not in this version. <BR>
eg... SELECT utyp03, team03 FROM use03 WHERE envn03 = 'ECO' returns 3 records. <BR>
however... SELECT first 1 utyp03, team03 FROM use03 WHERE envn03 = 'ECO' <BR>
would return only the first record. <p>TIA <BR>
Kit
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
   MC-STORE.COM