>>Start End >> 1 5 >> 6 8 >> 12 15 >> 19 24 >>>>
> select x.End+1, MIN(y.start)-1 as xstart ; > from table x, table y ; > where x.end < y.start ; > group by x.end ; > having xstart - x.end >= 1 >>As for the limits: add an and x.end > 10 and x.start < 17 to the where clause.
Data Set: Result: Expected: Start End 25200 43200 43201 43439 43201 43439 43440 44640 44641 44819 ?? 44861 44879 44640 44820 44821 44879 ?? 44926 44939 44820 44860 44861 44879 44880 44925 44926 44939 44940 44990I failed to mention that the end of one set might be the same as the start of the next. I think that's why the difference in the results from what was expected. I'll work with what you posted, I may be able to sort it out.