var query=from a in db.A join b in db.B.Where(c=>c.num>3) on new {a.type,a.item} equals new {b.type,b.item} into g from b in g.DefaultIfEmpty() select new { a, num=b==null?0:b.num, //这样来判断b表内是否有数据 };