比如在表number中有:
ID num
1 10
2 12
3 11
4 12
5 13
6 14
7 12
8 9
查找上表中num这行连续递增并且长度大于3的序列 像(10,12)就是长度为2的序列
ID num
1 10
2 12
3 11
4 12
5 13
6 14
7 12
8 9
查找上表中num这行连续递增并且长度大于3的序列 像(10,12)就是长度为2的序列
select a.*, (select b.id from number b where b.id>a.id order by b.id limit 1) as id2
from number a
) aa, number bb
where aa.id2=bb.id and bb.num-aa.num>=3