|
Guy, The "prior" in that example has nothing to do with fetch, but rather simply aliases the G3X1DTA/INBDTA table as 'prior' for the statement, so you could "select prior.IQDBSQ from ...." There is no SQL solution to selecting the 3 rows prior to the row you selected in that statement because how do you define "prior"? Without an order by the rows could come back in any order. Rob is correct, you might be able to do something w/RRN(). Something like: Select IQDBSQ, IQDREC, IQDDTA FROM G3X1DTA/INBDTA where RRN() >= (select RRN()-4 FROM G3X1DTA/INBDTA WHERE IQDBSQ > 56000 and IQDDTA like '%QTY%%%%-%' ) and RRN() <= (select RRN() FROM G3X1DTA/INBDTA WHERE IQDBSQ > 56000 and IQDDTA like '%QTY%%%%-%' ) Might do it, but I haven't tested it out. Not sure of what (if any) limitations the RRN() function has. RRN is a concept that's not native to SQL, it's an iSeries creation. -Walden ------------ Walden H Leverich III Tech Software (516) 627-3800 x3051 WaldenL@xxxxxxxxxxxxxxx http://www.TechSoftInc.com Quiquid latine dictum sit altum viditur. (Whatever is said in Latin seems profound.)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.