美文网首页
Lambda Groupby Join用法

Lambda Groupby Join用法

作者: 傅之橙 | 来源:发表于2018-08-03 16:49 被阅读5次
abc.GroupBy(c => c.activity_id).Select(c => new {
    id = c.Key,                                 //Key 就是上面的activity_id
    count = c.Count(),
    recharge_money = c.Sum(item => item.recharge_money),
    presentd_money = c.Sum(item => item.presented_money)
}).Join(businessRecharge, n => n.id, b => b.Id, (n, b) => new
{
    n.id,
    n.count,
    n.recharge_money,
    n.presentd_money,
    b.activity_name,
    b.is_open,
    activity_time = b.start_time.ToString() + " - " + b.end_time.ToString()
}).ToList();

相关文章

网友评论

      本文标题:Lambda Groupby Join用法

      本文链接:https://www.haomeiwen.com/subject/zecuvftx.html