0
(from SN1 in uow.SystemNotifications
join sn2 in
(
from SN2 in uow.SystemNotifications
select new { SN2.UserId, SN2.NotificationTypeId, SN2.ItemId }
).Distinct()
on new { SN1.UserId, SN1.NotificationTypeId }
equals new { sn2.UserId, sn2.NotificationTypeId }
select SN1).ToList();
當我執行此查詢,Distinct()不起作用。它選擇內部查詢結果中的所有記錄。如何修改它以在內部查詢結果中獲得不同的行。獨特的不能在LINQ嵌套選擇工作
「UserId」,「NotificationTypeId」和「ItemId」是什麼類型? –
UserId,NotificatioTypeId和ItemId是否會再次類似於第一行?如此清晰可見三者的獨特組合。 –
UserId,NotificationTypeId是int not null,itemId是int null –