Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Union query
On Dec 12, 11:57 am, "Abu Hamza" <ali..._at_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 DBAReceived on Tue Dec 12 2006 - 05:07:25 CST