以下查询连接 serverID 上的两个表并返回 ServerID 和属于它们的组件,如下所示
LINQ
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
如何检索上述结果,删除记录公共组件?这可以在 SQL 中使用 <> 不等于来实现。上面的代码如何实现?