`
sangei
  • 浏览: 329038 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

linq join group

阅读更多
 
 
var query = from de in dataContext.dispatchexception join d in dataContext.dispatch.Where(t => t.CreateTime >= startTime && t.CreateTime <= endTime && t.IsDeleted == 0 && (t.ShipperId == corpId || t.ConginerId == corpId || t.ReceiverId == corpId)) on de.dispatch_sn equals d.DispatchSN into j1 from j2 in j1.DefaultIfEmpty() group new { de, j2 } by de.exception_type into grouped select new { StatusType = grouped.Key, StatusCount = grouped.Count(t => t.j2.DId != null) };
 
 
 
 
 
 
 
 var reportQuery = from a in examReportTable.AsEnumerable()
                   join b in rvuTable.AsEnumerable()
                   on new { exam = a.Field<string>("exam"), examtype = a.Field<string>("examtype") } equals new { exam = b.Field<string>("rvuName"), examtype = b.Field<string>("rvuType") }
                   group b by new { reportDoc = a.Field<string>("reportDoc"), examtype = a.Field<string>("examtype") } into c
                   select new
                   {
                       DocName = c.Key.reportDoc,
                       examType = c.Key.examtype,
                       reportDocRvu = c.Sum(o => double.Parse(o.Field<string>("reportRvu"))),
                       reportDocNum =//examReportTable中对“exam”计数count这句怎么写?
                    };
 
 
 
分享到:
评论

相关推荐

    用C#实现对DataTable的JOIN,GROUP BY,FILTER,UNIONALL,DISTINCT

    用C#实现对DataTable的JOIN,GROUP BY,FILTER,UNIONALL,DISTINCT

    LINQ to SQL手册

    LINQ to SQL语句(4)之Join LINQ to SQL语句(5)之Order By LINQ to SQL语句(6)之Group By/Having LINQ to SQL语句(7)之Exists/In/Any/All/Contains LINQ to SQL语句(8)之Concat/Union/Intersect/Except LINQ to SQL...

    linq小案例

    linq小案例

    LINQ to SQL在行动:Join和Group-学习在.NET程序中编写数据访问功能的方法.pdf

    LINQ to SQL在行动:Join和Group-学习在.NET程序中编写数据访问功能的方法.pdf

    LINQ to SQL语句之Join和Order By

    说明:在Join操作中,分别为Join(Join查询), SelectMany(Select一对多选择)和GroupJoin(分组Join查询)。 该扩展方法对两个序列中键匹配的元素进行inner join操作 SelectMany 说明:我们在写查询语句时,如果被...

    LINQ_sql版

    into 提供一个标示符,它可以充当对 join group 或 select 子句结果的引用 orderby 对查询出的元素进行排序 join 按照两个指定匹配条件来联接俩个数据源 let 产生一个用于查询表达式中子表达式查询结果的范围变量

    LINQ_to_SQL语法及实例大全

    LINQ to SQL语句(4)之Join 13 Join操作符 13 1.一对多关系(1 to Many): 13 2.多对多关系(Many to Many): 14 3.自联接关系: 15 1.双向联接(Two way join): 15 2.三向联接(There way join): 16 3.左外部联接(Left...

    LINQ入门及应用 3/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 11/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    VS2008_LINQ_操作(完整)源码实例

    101 个 LINQ 源码实例 Select Where OrderBy GroupBy Join In, Like Lambda xml

    LINQ入门及应用 8/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 1/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 10/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    接触Linq必看简单教程

    从linq开始引C# 3.0。 2. C# 3.0入门系列(二) 数据库的准备,引入Linq To Sql的准备。 3. C# 3.0入门系列(三) 第一个Linq To Sql工程。 4. C# 3.0入门系列(四)-之Select操作 Select语法。 5. C#3.0入门...

    Linq基础学习资料,通俗易懂

    6.2.8 GroupJoin 18 6.2.9 Take 获取集合的前n个元素 19 6.2.10 Skip 跳过集合的前n个元素 19 6.2.11 Distinct 过滤集合中的相同项 19 6.2.12 Union 连接不同集合,自动过滤相同项 19 6.2.13 Concat 连接不同...

    LINQ入门及应用 5/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 7/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 13/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 2/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

    LINQ入门及应用 9/13

     3.5 group子句  3.5.1 IGrouping泛型接口  3.5.2 分组查询  3.6 into子句  3.7 排序子句  3.7.1 OrderBy和OrderByDescending  3.7.2 ThenBy和ThenByDescending  3.8 let子句  3.9 join子句  3.10 小结 第...

Global site tag (gtag.js) - Google Analytics