首页 > 数据库技术 > 详细

sql except 用法,找两个表中非共同拥有的

时间:2015-06-24 18:36:48      阅读:174      评论:0      收藏:0      [点我收藏+]

;with tt as (select a.id as id from [dbo].[1234] a where a.id not in (select a.ProtocolID from ProtocolInfo a where InfoUpdateTime>‘2015-06-19 14:49:00.307‘))


--select 25735+99352
--25735
select cc.DebetType,cc.UpdateTime,cc.InfoAddTime,* from ProtocolInfo cc where ProtocolID in (
select aa.ProtocolID from ProtocolInfo aa where aa.InfoUpdateTime<=‘2015-06-19 14:49:00.307‘
except
select tt.id from tt
)

 

 

EXCEPT是指在第一个集合中存在,但是不存在于第二个集合中的数据。

INTERSECT是指在两个集合中都存在的数据。

sql except 用法,找两个表中非共同拥有的

原文:http://www.cnblogs.com/yangjinwang/p/4598284.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!