var categories =
from p in db.Products
group p by new
{
p.CategoryID,
p.SupplierID
}
into g
select new
{
g.Key,
g
};
再加上一个表 buyer,变成这样:
var categories =
from p in Products
join t0 in buyer on p.bid equals t0.bid into et0
from dt0 in et0.DefaultIfEmpty()
group p by new
{
p.CategoryID,
p.SupplierID,
t0.buyer
} into g
select new
{
g.Key,
g
};