Solved

Can I perform a minus operation between two result sets, like oracle's MINUS operator?

Posted on 2002-03-18
2
1,171 Views
Last Modified: 2010-08-05
Hello

sample :

Two result sets: A and B.
I want a new set : A-B

Regards
C.M
0
Comment
Question by:cmurugavel
2 Comments
 
LVL 9

Expert Comment

by:ornicar
ID: 6879697
You can use the NOT EXISTS statement. It will be something like:

select * from a
where not exists (select * from B where A.keycolumn = B.keycolumn)
0
 
LVL 5

Accepted Solution

by:
amitpagarwal earned 50 total points
ID: 6879992
or you could use a temp table approach ...

select * into #a from tableA

delete #a
from #a, tableB
where #a.keyCol1 = tableB.keyCol2
and #a.keyCol2 = tableB.keyCol2 .....

select * from #a

this would give u the desired result set..


cheers !!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question