How do you perform a
Select top N * from as400table
type query against an as400/db2 database
I am only a baby-geek when it comes to IBM--I am a SQL Server guy. But I found the rownumber approach (which I have used successfully in Oracle) did not work in DB2. I used this one:
SELECT
MYFIELD
FROM
"SCHEMANAME"."TABLENAME"
WHERE
FILTERCOL1 = 000001
AND FILTERCOL2 = 1
ORDER BY
MYFIELD DESC FETCH FIRST ROW ONLY
(I ordered descending because I needed the last value.)
Hope this helps. Joey