=================================版权声明=================================

版权声明:原创文章 谢绝转载 

请通过右侧公告中的“联系邮箱(wlsandwho@foxmail.com)”联系我

勿用于学术性引用。

勿用于商业出版、商业印刷、商业引用以及其他商业用途。                

本文不定期修正完善。

本文链接:http://www.cnblogs.com/wlsandwho/p/5071967.html

耻辱墙:http://www.cnblogs.com/wlsandwho/p/4206472.html

=======================================================================

没啥说的,鄙视那些无视版权随意抓取博文的爬虫小网站站长,圣诞了,祝你们见到上帝。

=======================================================================

“为什么会写这么一些无聊又浅显的小博客呢?”

“因为这些都是我在企鹅群里回答的问题呀。把有代表性的写出来、记录一下,以后再遇到这些问题就不用回答了。多省事呀。”

=======================================================================

上问题。

看起来是年底了,要把不同的表里的数据进行汇总。可以猜测下是出库和入库的两个表,或者其他类似双生的东西。

既然事主敢打包票说不重复而且一一对应,那就按最简单的方法来吧。

事主没有提供主键,下文代码中的主键是我自己加的。

=======================================================================

 --by WLS
--
--网络代码有风险复制粘贴须谨慎
USE tempdb
GO IF OBJECT_ID (N't_AbyWLS', N'U') IS NOT NULL
DROP TABLE t_AbyWLS;
CREATE TABLE t_AbyWLS(id INTEGER PRIMARY KEY,MC NVARCHAR(5),S1 INTEGER)
GO IF OBJECT_ID (N't_BbyWLS', N'U') IS NOT NULL
DROP TABLE t_BbyWLS;
CREATE TABLE t_BbyWLS(id INTEGER PRIMARY KEY,MC NVARCHAR(5),S2 INTEGER)
GO GO INSERT INTO t_AbyWLS
SELECT 1,'A',23
UNION
SELECT 2,'B',34
UNION
SELECT 3,'C',56
GO INSERT INTO t_BbyWLS
SELECT 1,'A',11
UNION
SELECT 2,'B',12
UNION
SELECT 3,'C',13
UNION
SELECT 4,'D',NULL
UNION
SELECT 5,'E',14
GO SELECT * FROM t_AbyWLS
GO SELECT * FROM t_BbyWLS
GO SELECT a.id AS f1,a.mc AS f2,a.s1 AS f3,b.id AS f4,b.mc AS f5,b.s2 AS f6 FROM t_AbyWLS a FULL JOIN t_BbyWLS b ON a.id=b.id
GO WITH TempFull
AS
(
SELECT a.id AS f1,a.mc AS f2,b.id AS f4,b.mc AS f5,a.s1 AS f3,b.s2 AS f6 FROM t_AbyWLS a FULL JOIN t_BbyWLS b ON a.id=b.id
)
SELECT CASE WHEN f1 IS NULL THEN f4 ELSE f1 END AS A,
CASE WHEN f2 IS NULL THEN f5 ELSE f2 END AS MC,
f3 AS S1,
f6 AS S2
FROM TempFull
GO

没啥说的,基本上就是一个Full Outer Join。

=======================================================================

执行效果

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABhUAAAFUCAIAAACssyr/AAAgAElEQVR4nO3d/ZdbZ2En8Ptf5KfutruHOVbUxaVToA6UHUgItFm3ZlxBX0gplAxxW3PIhrQuM+ZMCVDS4/ASiova7mG6tkNWmG4bzGFPyaGzp2fbNFZiloxJX9ZbQtqUdQN47HmfSbQ/aEa6kq4e6Y6kuZqZz+d8j8/MlfTcR1eaHPTluVfRNQAAAABIMjMzs7GxEWU9DQAAAACGVL0/euDUZ3Zpsj6GAAAAAHtZQ39U2YX0RwAAAAADtRf6IxnOZP3eBgAAAPpjL/RHG7tBtVLJehY7R38EAAAAe0ZX/dFEsZyY0Ynm7GRzVPXAqc9cbzQ7Ozs7O/too5mZs9ezsxHrj+Lbm47e9evXyy9UJiaK7W7dLfRHAAAAsJd02x8Vy5XNFCsTbRLuj6IoCvzax/6oWGyextWrVyeKxUyalKp2/VH1wE6UN4/e9evXJyaKE8XiRLE4MVFsvXW30B8BAADAXrLN9UetK49GJ8qjoz31R1F74f5ovlGtP5qfny+/UCm/UHn4iWsTE8X57Kyvr1f7o/X19fj2poZofn6+uv6oduvDT1x7+IlrxfLmrbtF9flm/d4GAAAA+qOr/ii+oufixYu1n2dnZ6s/rKysFIvl0dGJjuVRoB6K90Ttfk7sj5qeUnW2zzzzTLlcvnjx4sNPXCsWyxMTxV4OUxRF27ipJt4fxbc3NURNjwrfmjiB8GTS3pp4/+rG8J31RwAAALCXpO6Pap1RpVJ59NFHq+XR/Px8sVg+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ujmMBpOMGNzWe6xa7z0rDTlvOMEtL+NJz4eTSh68WGL/+0OfjmiUhRFHVY0dOQmcONH31jYicWNR7Mli+Vj6LGj4itD2k+IM0VVdTQZbR9rRsuyxL/WLud71/bOmK160AnrqM5XHuNGp5L06fi2FCNZWJz05H6+tlD84apz2qnj1t/+qOEfTU+9+7WHyU+r/rrEv9awNBx6HLOyX9K4T/JwT0k1cwT/8sQepduvkaD6o++t/DdN37klqN/9KY7H/mZt/3xHW/6g1t+9rM/9fqPv/r2T732tlOHXvc7r3rNR37k0PTLX/nB/zDy3h+4/O1vxEfs4vvXqquEahchanlgrXzZvORQksaVSvUR6te9jqIoaloZtPVrbHlUbclSFFW/WK35ZLTzY1G9UYr3R7VB4nOw/khEREREhi5dnAchA0jwm8t2STpcKGcQb63tXdp5V6fpmspDe9wG9l+SjqcBDuGcB54eZh7vjxIv47XdJPZH154/9cjfnHv5iX//k58ee+sfvPnwZ2+7/VO33PqJW2574NDrPvbK197/o7dM/+grP5D/wWM3TX/hA5kfVhERERERCWT3foLa7elLL5BhOlYS/X9rBU+X27sJLWQbnuOmP9rJDOPM2/VH154/df6J//a6qVeNnsy99v4fff1Hf/wND7769R991aH7X/GqyR/O3fNDL/u1H/jwF6eyfwIiIiIiIhLMMH4OkT2R/r61qidIDqhH2MPZseOmP9rJDOPMA/3RtedPXb3+nc/9z8+Of/KOA+/9Nwfe94M3/+d/l3vfv82//4d+4VM//XfPX85+9iIiIiIi0inD+DlE9kS8tfZVduPLvRvnPLwzD/dHIiIiIiKy2zOMn0NkT8Rba19lN77cu3HOwztz/ZGIiIiIiIiIiISiPxIRERERERERkVAa+iMAAAAAaLHZH80AAAAAQBs7tP5ofle5vqvc2FUWdpXFXWVpF1reVVZ2ldVdZW1XWd9VNgAAoE/0R82yboTSyboRSifrRiidrBuhdLLugrYj60YonawboXSyboTSyboRSifrRiidrP83BgAAe8f/B2ZOK8nTKMgcAAAAAElFTkSuQmCC" alt="" />

附上执行计划

=======================================================================

(友情支持请扫描这个)

微信扫描上方二维码捐赠

SQL Server 2008 R2——使用FULL OUTER JOIN实现多表信息汇总的更多相关文章

  1. SQL Server 2008 R2——使用FOR XML PATH实现多条信息按指定格式在一行显示

    =================================版权声明================================= 版权声明:原创文章 谢绝转载  请通过右侧公告中的“联系邮 ...

  2. 安装 SQL Server 2008 R2 的硬件和软件要求(转)

    以下各部分列出了安装和运行 SQL Server 2008 R2 的最低硬件和软件要求.有关 SharePoint 集成模式下的 Analysis Services 的要求的详细信息,请参阅硬件和软件 ...

  3. SQL Server 2008 R2——学习/练习/错误/总结/搜集

    ==================================声明================================== 本文原创,转载在正文中显要的注明作者和出处,并保证文章的完 ...

  4. 数据库备份和恢复秩序的关系(周围环境:Microsoft SQL Server 2008 R2)

    让我们来看看在备份序列新手 --1.塔建环境(生成测试数据和备份文件) /* 測试环境: Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) ...

  5. SQL Server 2008 R2执行存储过程sp_MailItemResultSets引起大量PREEMPTIVE_OS_WAITFORSINGLEOBJEC等待

      从监控工具DPA中发现一个数据库(SQL Server 2008 R2)的等待事件突然彪增,下钻分析发现数据库执行存储过程sp_MailItemResultSets时,引起了非常严重的等待(Hig ...

  6. 利用SQL Server 2008 R2创建自动备份计划

    本文主要利用SQL Server 2008 R2自带的"维护计划"创建一个自动备份数据的任务. 首先,启动 Sql Management studio,确保"SQL Se ...

  7. Microsoft SQL Server 2008 R2 安装卸载

    问题 问题1 标题: Microsoft SQL Server 2008 R2 安装程序 ------------------------------ 出现以下错误: Could not open k ...

  8. SQL Server 2000向SQL Server 2008 R2推送数据

    [文章摘要]最近做的一个项目要获取存在于其他服务器的一些数据,为了安全起见,采用由其他“服务器”向我们服务器推送的方式实现.我们服务器使用的是SQL Server 2008 R2,其他“服务器”使用的 ...

  9. SQL Server 2008 R2 升级到 Service Pack 3后Report Builder启动不了

    一同事将测试服务器从SQL Server 2008 R2 SP2升级到了SQL Server 2008 R2 SP3后发现Report Service的报表编辑时启动不了Report Builder, ...

随机推荐

  1. Myeclipse无法开启Servers视图解决办法

    IDE报错如下:  解决办法:1.首先关闭MyEclipse工作空间. 2.然后删除工作空间下的 “/.metadata/.plugins/org.eclipse.core.runtime/.sett ...

  2. 用JAVA实现插值查询的方法(算近似值,区间求法)

    插值查询:如果有这样一张表,有一列叫水位,有一列叫库容,比如下面的图. 我现在想做这么一件事情:对于这个测站而言,当我输入某一个水位或者库容的时候,想要查询到对应的水位或者库容呢? 而这个值不一定是存 ...

  3. JAVA中关于锁机制

    本文转自 http://blog.csdn.net/yangzhijun_cau/article/details/6432216 一段synchronized的代码被一个线程执行之前,他要先拿到执行这 ...

  4. Message和handler传递对象

    Bundle可以传递对象,message又可以传递Bundle于是就可以利用buddle作为中间载体传递对象了 Message msg = Message.obtain();  Bundle b =  ...

  5. jQuery-1.9.1源码分析系列(三) Sizzle选择器引擎——词法解析

    jQuery源码9600多行,而Sizzle引擎就独占近2000行,占了1/5.Sizzle引擎.jQuery事件机制.ajax是整个jQuery的核心,也是jQuery技术精华的体现.里面的有些策略 ...

  6. MySQL PXC构建一个新节点只需IST传输的方法

    需求场景:原有的pxc环境数据量已经比较大,新买的服务器要加入此集群中,如何让其用IST的方式传输,而不是SST. PXC传输数据有两种方式: IST: Incremental State Trans ...

  7. 数字限时增长效果实现:numberGrow.js

    这是上周工作中写到的一个功能,大概的效果就是页面中有几处数字,统计公司的一些业务信息,需要在第一次出现的时候,做一个从0开始增长,大概2秒自动增长到真实数值,并停止增长的效果.这个问题的重点在于解决如 ...

  8. 10.Configure One-to-Many(配置一对多关系)【Code-First系列】

    现在,我们将学习怎么配置一对多的关系. Visit Entity Relationship section to understand how EF manages one-to-one, one-t ...

  9. C#~异步编程再续~await与async引起的w3wp.exe崩溃

    返回目录 最近怪事又开始发生了,IIS的应用程序池无做挂掉,都指向同一个矛头,async,threadPool,Task,还有一个System.NullReferenceException,所以这些都 ...

  10. java web学习总结(十六) -------------------数据库连接池

    一.应用程序直接获取数据库连接的缺点 用户每次请求都需要向数据库获得链接,而数据库创建连接通常需要消耗相对较大的资源,创建时间也较长.假设网站一天10万访问量,数据库服务器就需要创建10万次连接,极大 ...