下面的查詢連接上SERVERID兩個表,並返回該服務器ID的和屬於他們的組件如下圖所示如何用SQL語法和<>重寫這個LINQ查詢?
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
如何檢索以上結果,清除記錄共同組件?這可以通過使用<>不等於來實現。上述代碼如何實現?
所以,你只是想排除的結果'常見component'設置? – Justin
@demo_user檢查[Jon Skeet的回答](http://stackoverflow.com/a/3762875/1671639),你一定會明白。 – Praveen
[使用Linq不等於]的可能重複(http://stackoverflow.com/questions/3669507/using-linq-not-equals) – nawfal