次のクエリは、serverID で 2 つのテーブルを結合し、以下に示すように、ServerID とそれらに属するコンポーネントを返します。
リンク
var header = from a in this.db.Servers
where a.ServerID.Contains(match)
join b in this.db.Components
on a.ServerID equals b.ServerID into g
select new
{
a.ServerID,
Comp = g.Select(x => x.Name),
};
出力
Server X
common component
component 1x
component 2x
component 3x
Server Y
common component
component 1y
component 2y
component 3y
Server Z
common component
component 1z
component 2z
component 3z
共通コンポーネントの記録を削除して、上記の結果を取得する方法は? これは、<> not equal to を使用して SQL で実現できます。上記のコードでどのように達成できますか?