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. Improving Sequential Recommendation with Knowledge-Enhanced Memory Networks(知识图谱)

    本文作者:杨昆霖,2015级本科生,目前研究方向为知识图谱,推荐系统,来自中国人民大学大数据管理与分析方法研究北京市重点实验室. 引言 经常上购物网站时,注意力会被首页上的推荐吸引过去,往往本来只想买 ...

  2. 下载恶意pcap包的网站汇总

    说几个我经常用的,免费的:1.  Malware  Traffic  Analysis:  http://www.malware-traffic-analysis.net/2018/index.htm ...

  3. windows(hexo)使用git时出现:warning: LF will be replaced by CRLF

    hexo出现warning: LF will be replaced by CRLF git config --global core.autocrlf false //禁用自动转换

  4. C# 利用log4net 把日志写入到数据库

    效果图: 1:第一步创建SQL表结构   CREATE TABLE [dbo].[LogDetails] (   [LogID] int NOT NULL IDENTITY(1,1) ,   [Log ...

  5. No Compiler is Provided in this environment Perhaps you are running on JRE rather than a JDK

    问题描述: 在使用Jenkins打包的时候,抛出这样的错,但JDK和Maven都是已经安装,没问题了的.其中Jenkins用的Pipline流水线来部署项目. 问题解决: 在使用Pipline部署项目 ...

  6. LeetCode(数据库):分数排名

    ,)); Truncate table Scores; ', '3.5'); ', '3.65'); ', '4.0'); ', '3.85'); ', '4.0'); ', '3.65'); 编写一 ...

  7. 开源项目(4-2)手势识别-Keras/Theano/OpenCV实现的CNN手势识别

    https://github.com/asingh33/CNNGestureRecognizer 我提供了两种捕获模式: 二进制模式:在这里我首先将图像转换为灰度,然后应用高斯模糊效果和自适应阈值滤波 ...

  8. [VSCode] Adding Custom Syntax Highlighting to a Theme in VSCode

    VSCode Themes are a quick way to update the color scheme and syntax highlighting of your code, but y ...

  9. LeetCode 1026. Maximum Difference Between Node and Ancestor

    原题链接在这里:https://leetcode.com/problems/maximum-difference-between-node-and-ancestor/ 题目: Given the ro ...

  10. Windows是如何将64位Ntdll映射到32位进程的---转自简书

    今天我们探索一个问题: 64位的ntdll是如何被加载到WoW64下的32位进程?今天的旅程将会带领我们进入到Windows内核逻辑中的未知领域,我们将会发现32位进程的内存地址空间是如何被初始化的. ...