LinQUnion合并查询连接不同的集合,自动过滤相同项;延迟。即是将两个集合进行合并操作,过滤相同的项

var cities = (from p in mylinq.System_Places

          where p.PID == place

          select p).Union(

          from q in mylinq.System_Places

          where q.Parentid==place

          select q

          );

  

LinQ中的Concat连接查询连接不同的集合,不会自动过滤相同项;延迟。

  (from p in System_Places

     where p.PID == 1010

     select p).Concat(

       from q in System_Places

         where q.Parentid==1010

         select q

         ).Concat(

           from n in System_Places

             where n.Parentid==1010

              select n

   )

  

LinQ中的Intersect相交查询:获取不同集合的相同项(交集),即两集合都出现的项。

  (from c in Bst_System_Places

  select c.CnPlaceName).Intersect(

  from e in Bst_Company_Jobs

  select e.WorkPlace)

  

LinQ中的Except与非查询:排除相交项,即从某集合中排除与另一集合中相同的项,以前集合为主。。。

  (from e in Bst_Company_Jobs

  select e.WorkPlace).Except(

  from c in Bst_System_Places

  select c.CnPlaceName)

  

LinQ中合并、连接、相交、与非查询的更多相关文章

  1. Linq中的连接(join)

    http://www.cnblogs.com/scottckt/archive/2010/08/11/1797716.html Linq中连接主要有组连接.内连接.左外连接.交叉连接四种.各个用法如下 ...

  2. LINQ中的连接(join)用法示例

    Linq中连接主要有组连接.内连接.左外连接.交叉连接四种.各个用法如下. 1. 组连接 组连接是与分组查询是一样的.即根据分组得到结果. 如下例,根据publisther分组得到结果. 使用组连接的 ...

  3. Linq 中 表连接查询

    public void Test(){ var query = from a in A join b in B on A.Id equals B.Id into c from d in c.Defau ...

  4. Linq中left join之多表查询

    using System; using System.Collections; using System.Collections.Generic; using System.Data; using S ...

  5. Linq连接查询之左连接、右连接、内连接、全连接、交叉连接、Union合并、Concat连接、Intersect相交、Except与非查询

    内连接查询 内连接与SqL中inner join一样,即找出两个序列的交集 Model1Container model = new Model1Container(); //内连接 var query ...

  6. 数据库和linq中的 join(连接)操作

    sql中的连接 sql中的表连接有inner join,left join(left outer join),right join(right outer join),full join(full o ...

  7. linq操作符:连接操作符

    linq中的连接操作符主要包括Join()和GroupJoin()两个. 一.Join()操作符 Join()操作符非常类似于T-SQL中的inner join,它将两个数据源进行连接,根据两个数据源 ...

  8. linq中的contains条件

    linq中的contains条件   在sql查询语句中,in 在linq 中用contains,并且contains前面是数组,而后面是列名,如: SELECT distinct BH FROM c ...

  9. 2.4 LINQ中使用where子句指定筛选条件

    本篇讲解的内容有: 使用where筛选过滤LINQ查询 带逻辑的where筛选 多个where筛选子句 [1.使用where筛选过滤LINQ查询] 通常一个LINQ查询不会如前面的示例代码这么简单,经 ...

随机推荐

  1. 编译heartbeat出现的问题

    如报 cc1: warnings being treated as errors pils.c:245: error: initialization fromincompatible pointer ...

  2. 《exception》第九次团队作业:Beta冲刺与验收准备(第二天)

    一.项目基本介绍 项目 内容 这个作业属于哪个课程 任课教师博客主页链接 这个作业的要求在哪里 作业链接地址 团队名称 Exception 作业学习目标 1.掌握软件黑盒测试技术:2.学会编制软件项目 ...

  3. python开发应用之-时间戳

    golang 获取时间戳用time.Now().Unix(),格式化时间用t.Format,解析时间用time.Parse package main import ( "fmt" ...

  4. 通过vue-cli搭建vue项目

    一.搭建环境 安装node.js 从node.js官网下载并安装node,安装过程很简单,一路“下一步”就可以了.安装完成之后,打开命令行工具(win+r,然后输入cmd),输入 node -v,如下 ...

  5. GIL锁是什么鬼?

    参考链接: http://cenalulu.github.io/python/gil-in-python/ GIL不是Python特性 GIL是Python解释器(Cpython)时引入的概念,在JP ...

  6. [NPM + React] Prepare a Custom React Hook to be Published as an npm Package

    Before we publish our package, we want to make sure everything is set up correctly. We’ll cover vers ...

  7. LeetCode 428. Serialize and Deserialize N-ary Tree

    原题链接在这里:https://leetcode.com/problems/serialize-and-deserialize-n-ary-tree/ 题目: Serialization is the ...

  8. lxml_time_代理

    import requests from pyquery import PyQuery as pq import json import jsonpath from lxml import etree ...

  9. learning scala repreated parameters

  10. 如何用Windbg从dump获取计算机名、主机名

    对内存转储时发生的事情有一定的了解是非常重要的.这有助于您确定要执行哪些WinDbg命令,并为您提供一些有关如何解释这些命令输出的上下文.我正在查看一个服务器的内存转储,该服务器存在性能问题.我在内存 ...