程序代码:
CREATE CURSOR cpfl (cplb c(1),cpbh n(1))
INSERT INTO cpfl VALUES ([A],1)
INSERT INTO cpfl VALUES ([A],2)
INSERT INTO cpfl VALUES ([B],1)
INSERT INTO cpfl VALUES ([C],1)
INSERT INTO cpfl VALUES ([D],5)
INSERT INTO cpfl VALUES ([D],7)
INSERT INTO cpfl VALUES ([E],1)
INSERT INTO cpfl VALUES ([A],3)
INSERT INTO cpfl VALUES ([B],2)
INSERT INTO cpfl VALUES ([B],5)
INSERT INTO cpfl VALUES ([C],3)
INSERT INTO cpfl VALUES ([E],2)
INSERT INTO cpfl VALUES ([A],5)
INSERT INTO cpfl VALUES ([E],5)
INSERT INTO cpfl VALUES ([D],8)
INSERT INTO cpfl VALUES ([C],4)
INSERT INTO cpfl VALUES ([A],6)
INSERT INTO cpfl VALUES ([B],6)
INSERT INTO cpfl VALUES ([E],7)
INSERT INTO cpfl VALUES ([B],7)
SELECT CPLB,MIN(CPBH) 起,MAX(CPBH) 止 FROM (SELECT *,RECNO() XH,ABS(RECNO()-CPBH) CZ FROM (SELECT * FROM CPFL ORDER BY 1,2) A) B GROUP BY CZ,CPLB ORDER BY 1,2
结果:
图片附件: 游客没有浏览图片的权限,请
登录 或
注册