** 测试数据
create cursor 彩票(开奖日期 C(8),红球1 I,红球2 I,红球3 I,红球4 I,红球5 I,红球6 I,连号 I)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018067',1,2,3,4,15,18,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018068',8,9,10,11,12,30,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018069',6,7,8,9,10,11,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018070',4,9,15,16,19,27,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018071',2,5,6,13,16,19,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018072',11,16,19,22,25,30,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018073',2,9,14,15,16,23,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018074',9,11,14,20,27,30,0)
insert into 彩票(开奖日期,红球1,红球2,红球3,红球4,红球5,红球6,连号) values('2018075',7,9,12,13,22,24,0)
select 彩票
brow
** 扫描表
scan
scatter fields 红球1,红球2,红球3,红球4,红球5,红球6 to myAry &&把当前记录放到数组,然后排序数组
asort(myAry)
lh=0
for i=1 to 5
if myAry[i]=myAry[i+1]-1 &&第i位与第i+1位比较,第i位=第i+1位-1,计数1次
lh=lh+1
endif
endfor
repl 连号 with lh
endscan
brow