我想加入兩個表,它們有兩個相同的列。我已經嘗試過,但在新{}等於新{}時出錯。C#使用Linq來加入2個表,並且有兩個相同的列
我的代碼:
var results = from table1 in table.AsEnumerable()
join table2 in comment.AsEnumerable()
//Comment
on new {table1.Field<string>("SignalName"), table1.Field<int?>("MessageID")}
equals new {table2.Field<string>("SignalName"), table2.Field<int?>("MessageID")}
into prodGroup
from table3 in prodGroup.DefaultIfEmpty()
select new
{
// something is there
};
非常感謝! –