List Table1 = new List();
List Table2 = new List();
var objList = from ListData in
(from a in Table1
join b in Table2 on a.Id equals b.Id into t2
from t2Data in t2.DefaultIfEmpty()
select new
{
Product = a.Product,
Title = t2Data.Title,
Amount = a.Amount
}
)
group ListData by new
{
ListData.Product,
ListData.Title
} into GroupData
select new
{
Product = GroupData.Key.Product,
Title = GroupData.Key.Title,
Amount = GroupData.Sum(OL => OL.Amount)
};
2 comments:
Thanks.
The grouping and the sum is worked properly.
Nice example.
Keep going.
PPKN
Thanks,
The code for grouping with LINQ is worked properly.
Keep going.
PPKN
Post a Comment