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
if you are substracting a percentage and updating a table use this
UPDATE `TABLENAME` SET `COLUMNNAME` = (50 / 100) * `COLUMNNAME`;
please note that the (50 / 100) is for 50% so in this case this query will discount 50% from the total value of the row!
You can also do this with the NOT IN
clause
For example, assuming the stored procedures have given you table variables called @AllDocuments
and @ActiveDocuments
and each document has an identifier column called DocId
SELECT * FROM @AllDocuments
WHERE DocId NOT IN
(SELECT DocId FROM @ActiveDocuments)
Adapt this as appropriate to match your table / column names.