专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > VFP

请问一个命令如何写

发布时间:2010-05-24 22:03:50 文章来源:www.iduyao.cn 采编人员:星星草
请教一个命令怎么写?
vfp9.0sp2环境下一个表tb中有一字符型字段xh:
xh 
32
34
35
36
38
39
41
42
43
47
48

想找到不连续的xh:33、37、40、44、45、46,怎么写命令?


------解决方案--------------------
1、生成1-N的数列,与工作表连接;
2、
SELECT a.*,b.xh FROM r:temptty a LEFT JOIN r:temptty b ON a.id=b.id+1
循环判断两个XH是否连续
------解决方案--------------------
SQL code
Create Cursor tb (xh i)
Insert Into tb Values (32)
Insert Into tb Values (34)
Insert Into tb Values (35)
Insert Into tb Values (36)
Insert Into tb Values (38)
Insert Into tb Values (39)
Insert Into tb Values (41)
Insert Into tb Values (42)
Insert Into tb Values (43)
Insert Into tb Values (47)
Insert Into tb Values (48)

Create Cursor t1 (xh i)
For m.lnI=32 To 48
    Insert Into t1 Values (m.lnI)
Endfor


Select t1.xh From t1 Where xh Not In (Select xh From tb)
* 或
Select t1.xh From t1 Left Join tb On t1.xh=tb.xh Where tb.xh Is Null

------解决方案--------------------
sele xh from tb where xh not in (sele recno()+31 from tb)
???
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: