1

基準に基づいてセットの減算を行いたいのですが。疑似クエリは次のようになります。

select table1.columnn1
      ,table1.column2
  from table1, table2
 where (table1.column1.value1 not in table2.column1
        and
        table1.column2.value2 not in table2.column2)

私はここにそれを作ることができます:

dim list = From tbl1 In table1 Where tt.column1 ...

そしてそこから私は何をすべきかわかりません。

4

1 に答える 1

2

ExceptLINQ の標準クエリ演算子を見てください。これにより、2 つのシーケンスの集合差が生じます。

http://msdn.microsoft.com/en-us/library/system.linq.enumerable.except.aspx

以下のサンプルのように、演算子を使用しContainsて目的を達成することもできます。

dim table2Col1 = from t in table2 select t.column1
dim table2Col2 = from t in table2 select t.column2

dim results = _
   from t in table1 _
   where not table2Col1.Contains(t.column1) _
   and  not table2Col2.Contains(t.column2) _
   select new with { .column1=t.column1, .column2=t.column2 }
于 2009-05-06T08:51:13.460 に答える