0

所以我有 2 个这样的数据表:

table1:    |mean1|mean2|   table2: |mean1|mean2|
           -------------           -------------
           |1.2  | 1.3 |           |2.2  | 1.3 |
           |2.0  | 2.0 | <=======> |2.0  | 2.0 |
           |1.0  | 2.3 |           |3.0  | 1.0 | 
           |1.4  | 2.7 |           |3.0  | 1.2 |
           |1.5  | 2.8 |           |2.7  | 1.3 |
           |2.2  | 1.1 | <=======> |2.2  | 1.1 |

我的目标是从 table2 中找到包含在 table1 中的值。它必须用VB.Net编写

在 table1 中查找重复项的代码仅如下所示:

Dim dupes = From row In table1.AsEnumerable()
            Group row By G = New With {.mean1= row.Field(Of Double)("mean1")}.mean1,
            New With {.mean2= row.Field(Of Double)("mean2")}.mean2 Into DupMean = Group
            Where DupMean.Count() > 1
            Select DupMean

如何将代码与 table2 结合起来?

4

1 回答 1

1

类似的东西

Dim dupes = From row In table1.AsEnumerable()
            Join row2 In table2.AsEnumerable()
            On row("mean1") Equals row2("mean1") And row("mean2") Equals row2("mean2")
            Select New With {.RowInT1 = row, .RowEqualInT2 = row2}

或者,对于包含每个表的内部副本:

Dim dupes = From row In table1.AsEnumerable().Concat(table1.AsEnumerable()()
            Group row By G = New With {.mean1 = row("mean1"), .mean2 = row("mean2")}
            Into DupMean = Group
            Where DupMean.Count() > 1
            Select DupMean
于 2013-11-13T11:18:20.173 回答