|
From: Alan Shore
This problem intrigued me and BOTH are nice suggestions, but ( and I could
be wrong on this) if the ones that are missing are
15
16
17
21
this sql would NOT report 16 & 17 as missing
Thus the second SQL. A more polished version (and then I have work to do):
SELECT A.SEQ+1 HOLESTART, MIN(C.SEQ)-1 HOLEEND
FROM MYSEQ A, MYSEQ C
WHERE NOT EXISTS
(SELECT 1 FROM MYSEQ B WHERE B.SEQ = (A.SEQ+1))
AND C.SEQ > A.SEQ GROUP BY A.SEQ
ORDER BY HOLESTART
Joe
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.