Solved

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

Posted on 2002-03-18
2
1,172 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 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: 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

Suggested Solutions

Title # Comments Views Activity
Sybase ASE BCP In With Table with No Identity Column 1 1,206
Cannot create ODBC connection over the network 3 1,243
connect to sybase then query 1 780
SQL Query Syntax 11 169
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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 …

726 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