很抱歉的混乱主题行:)删除从数据表行,其中一个条目在其他DataTable
我想和我的数据表中的SQLlike查询存在:S:我想要做这样的事情
// Is named "BadValues" Rows contain: id1, id2
DataTable tableReadFromFile = readFromFile();
// Is named "AllValues" Rows contain id1, id2
DataTable tableReadFromSql = readFromSql
DataTable resultTable =
tableReadFromFile.select("where AllValues.id1 not in (select id1 from BadValues) and AllValues.id2 not in (select id2 from BadValues)");
所以,如果我的 “BadValues” 表是这样的:
id1 id2
0 1
10 11
20 21
和我的 “AllValues” 表是这样的:
id1 id2
0 1
0 2
1 1
10 11
10 12
12 11
20 21
20 22
22 21
我想resultTable看起来像这样:
id1 id2
0 2
1 1
10 12
12 11
20 22
22 21
换句话说:如果对ID1,ID2表中的“BadValues”和“AllValues”的存在我想删除它们,以便它们不存在于结果表中。
如果在SQL数据库中存在表“BadValues”,那么在SQL中这样做会相当简单,但由于它是从不可能的文件加载的。
现在,我循环遍历“BadValues”中的所有行,并使用设置的id1和id2值构造单个SQL查询。由于我有相当多的数据,这非常耗时。
任何提示被赞赏!
这个伎俩!谢谢 :) – user1028037