8,497
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 返回不重复的Customers
/// </summary>
public static List<Customers> DistinctSearch()
{
List<Customers> customers = null;
using (NorthwindEntities entity = new NorthwindEntities())
{
//以NorthWind为例,查找地区为London,并按照CustomerID升序,且不重复的记录
customers = entity.Customers.Where(c => c.City == "London").OrderBy(n => n.CustomerID).Distinct().ToList();
}
return customers;
}
var query=(from a in db.AAA
where a.id== db.BBB.Where(b=>b.name==a.name)
select a).Distinct();