显示未使用的数字 [英] Show numbers not used

查看:68
本文介绍了显示未使用的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库,可以记录用户手动输入的其他系统的一些信息。目前我有一个子窗体显示使用的ID列表。是否有一种简单的方法来显示未使用的数字列表(因此它们可用),而无需创建一个包含1到1200之间每个数字的表格?例如,假设我使用了以下ID:

I have a database that logs some information from another system that is entered manually by the user. Currently I have a subform showing the list of IDs used. Is there a simple way to show a list of numbers not used (so they are available) without having to create a table with every number from 1 to 1200? So for example, say I have the following IDs used:

展开 | 选择 | Wrap | 行号

推荐答案

我使用的形式这是为了检查是否缺少实验室序列。

这是我的模板,我只是根据需要更改访问泛型。

它运行良好...我不知道t通常使用TOP。谓词因为我希望所有遗失都返回。

I use a form of this to check for missing lab sequeces.
It''s my template that I just change the access generics as needed.
it works well... I don''t usually use the "TOP" predicate as I want all missing returned.

展开 | 选择 | Wrap | 行号


这不仅仅适用于数字之间最多丢失1个?如果你连续缺少1个以上怎么办?例如,你有1和4所以你想要返回2和3.
Doesn''t that only work if you have at most 1 missing in between numbers? What if you''re missing more than 1 consecutively. For example, you have 1 and 4 so you would want to return 2 and 3.


这是一个有趣的结构,使用递归的公用表表达式,这是一个非常神秘和强大的设备TSQL。不幸的是,您需要使用MS SQL后端才能使用它。如果你是,你需要用你的表名和LineItemID替换LineItem,你需要检查缺少数字的列。

This is a fun structure that uses a recursive Common Table Expression, which is a very mysterious and powerful device of TSQL. Unfortunately, you will need to be on a MS SQL backend to use it. If you are, you would need to replace LineItem with your table name and LineItemID with the column you want inspect for missing numbers.

展开 | 选择 | 换行 | 行号


这篇关于显示未使用的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆