Path: text.usenetserver.com!out02b.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!postnews.google.com!73g2000cwn.googlegroups.com!not-for-mail
From: "sybrandb" <sybrandb@gmail.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: Union query
Date: 12 Dec 2006 03:07:25 -0800
Organization: http://groups.google.com
Lines: 23
Message-ID: <1165921645.052860.50260@73g2000cwn.googlegroups.com>
References: <1165921041.738399.38750@16g2000cwy.googlegroups.com>
NNTP-Posting-Host: 192.33.238.6
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1165921650 6696 127.0.0.1 (12 Dec 2006 11:07:30 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 12 Dec 2006 11:07:30 +0000 (UTC)
In-Reply-To: <1165921041.738399.38750@16g2000cwy.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1),gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 PXYBEBR003
Complaints-To: groups-abuse@google.com
Injection-Info: 73g2000cwn.googlegroups.com; posting-host=192.33.238.6;
   posting-account=d8kqXg0AAADvDUR8IdYEU7pAZnZ1O2PC
Xref: usenetserver.com comp.databases.oracle.server:418979
X-Received-Date: Tue, 12 Dec 2006 06:07:30 EST (text.usenetserver.com)



On Dec 12, 11:57 am, "Abu Hamza" <ali...@sunnipath.com> wrote:
> I have a query of the form
>
> query1 union query2
>
> Both queries have a common field  f1.
> My problem is to get only those records from query2 which have a
> corresponding record (same f1 value) in query1. In other words there
> should be no record in query2 that has x in f1 and there does not exist
> an x in query1. Is there a simple way or do I have to write a complex
> 'exists' condition in query2 ?
>
> thx.


Look up the INTERSECT operator in your documentation.

-- 
Sybrand Bakker
Senior Oracle DBA

