搜索多个列表中缺少的条目 [英] Search multiple list for missing entries
问题描述
我有3个列表,我会在这里简单。
I have 3 lists, I will make them simple here.
字母清单
A
B
C
list of letters
A
B
C
数字列表
1
2
3
list of numbers
1
2
3
混合
A,1
A,2
B,2
B,3
C,1
C,3
Mixed
A,1
A,2
B,2
B,3
C,1
C,3
我需要知道缺少什么:
A,3
B,1
C,2
I need to know what is missing:
A,3
B,1
C,2
字母列表有大约85个条目
,数字列表有500个条目。
The list of letters has about 85 entries
and the list of numbers has about 500 entries.
这个混合列表有大约75,000个条目。
The mixed list has about 75,000 entries.
我可以使用数据库查询5.0)或Turbo Delphi 2006来处理文本文件。
I can use either a database query (mysql 5.0) or Turbo Delphi 2006 to process text files. What would be the best way to find what is missing?
感谢,
Dave
Thanks,
Dave
推荐答案
没有必要创建额外的表。以下查询也可以工作:
There's no need to create extra tables. The following query would work just as well:
SELECT c.chr, n.num
FROM chars c, nums n
WHERE NOT EXISTS (SELECT 1
FROM mix m
WHERE m.chr = c.chr AND m.num = n.num)
这篇关于搜索多个列表中缺少的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!