Foxtable(狐表)用户栏目专家坐堂 → 检查表中数据是否合理


  共有2408人关注过本帖树形打印复制链接

主题:检查表中数据是否合理

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109483 积分:557077 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/11/10 9:03:00 [显示全部帖子]

如果是后台表,保存后使用sql判断效率高一点

select count(*) as 不合理数量 from {表C} as a inner join {表C} as b on a.[_Identify] <> b.[_Identify] where (a.起始编码 < b.起始编码 and a.结束编码 > b.起始编码) or (a.结束编码 > b.结束编码 and a.起始编码 < b.结束编码 )

或者使用代码遍历处理。

for each  r as row in tables("表C").rows
dim dr as datarow = datatables("表C").find("((起始编码 < " & r("起始编码") & " and 结束编码 > " & r("起始编码") & ") or (结束编码 > " & r("结束编码") & " and 起始编码 < " & r("结束编码") & " )) and _Identify <>" & r("_Identify"))
if dr isnot nothing then
msgbox("不合理")

 回到顶部