How do I 'subtract' sql tables?

后端 未结 14 2018
死守一世寂寞
死守一世寂寞 2020-12-05 13:12

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

14条回答
  •  不知归路
    2020-12-05 13:58

    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
    

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

提交回复
热议问题