Re: SQL TOP x



Works for me - Which release are you on?

Bob Bergstrom wrote:
Below is the structure we would need and will not work on the iSeries...
Any ideas?

SELECT * FROM TABLEA a left outer join
(SELECT * from TABLEB
WHERE FIELD1 <> '3' and FIELD2 = 'D'
FETCH FIRST 1 ROW ONLY
) B
on a.FIELDA = b.FIELDA
and A.FIELDB = B.FIELDB
where FIELDC = 2 and FIELDD not in ('Z') order by FIELDC, FIELDB


On Tue, 15 Feb 2005 11:26:13 -0800, Elvis wrote:

select * from mytable
fetch first X rows only
optimize for X rows

--
Kent Milligan
ISV Enablement - System i
kmill@xxxxxxxxxxxxxxxx (spam trick) GO HAWKEYES!!
>>> ibm.com/iseries/db2
(opinions stated are not necessarily those of my employer)
.