日期:2014-05-20 浏览次数:20933 次
var maxids = brandfile.GroupBy(x => x.fid).Select(g => g.Max(x => x.fieldid));
var b = brandfile.Where(x => x.typeid == 2 && maxids.Contains(x => x.fileid));
var result = from n in NewsInfo 
             join b in brandfile on n.newsid equals b.fid into n1
             from n2 in n1.DefaultIfEmpty()
             select new 
             {
                NewsInfo = n,
                FileName = b.filename
             };
------解决方案--------------------