如何“减去"sql 表? [英] How do I 'subtract' sql tables?

查看:22
本文介绍了如何“减去"sql 表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这并不是我真正要寻找的减法.而且我知道它不是联合或交集......我得到了一个长而复杂的存储过程,它返回一个活动和非活动文档表.我还得到了一个类似的存储过程,它返回另一个只包含活动文档的表.

Its not really a subtraction I'm looking for. And I know its not a union or intersection... I have been given a long and complex stored procedure that returns a table of active and inactive documents. I have also been given a similar stored procedure that returns another table that contains only the active documents.

如何使用这两个存储过程获取非活动文档表?

How could I get a table of inactive documents using these two store procedures?

我们使用的是 SQL Server 2005.

We are using SQL Server 2005.

推荐答案

你要找的set操作叫做MINUS,但在SQL Server中关键字是EXCEPT

The set operation you are looking for is called MINUS, but in SQL Server the keyword is EXCEPT

  SELECT ... // all documents
  EXCEPT
  SELECT ... // active documents

我相信 EXCEPT set 操作在 SQL Server 2005 中可用.

I believe that the EXCEPT set operation became available in SQL Server 2005.

这篇关于如何“减去"sql 表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆