?
Solved

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

Posted on 2002-03-18
2
Medium Priority
?
1,174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 150 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 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