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?
We are using SQL Server 2005.
The SQL minus (-) operator is used to subtract one expression or number from another expression or number.
Multiply the subtract from data by (-1) and then sum() the both amount then you will get subtracted amount. Highly active question.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With