Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: better way

Re: better way

From: Stephen T. Parfitt <steve.parfitt_at_sympatico.ca>
Date: Wed, 17 Oct 2001 11:20:50 -0400
Message-ID: <3BCDA1D2.2D3CB785@sympatico.ca>


I'm assuming that you want to see the row from resultset1 'in preference' to the same row from resultset2 when there is a match on keys.

If this assumption is correct, then your solution will not work since it will remove ALL the intersecting rows ... both those collected from resultset1 AND those from resultset2.

You would need something like this:

(SELECT keycolumn || '_1'
  FROM resultset1
UNION
SELECT keycolumn || '_2'
  FROM resultset2)
MINUS
 (SELECT keycolumn || '_2'
   FROM resultset1,

         resultset2
  WHERE resultset1.keycolumn = resultset2.keycolumn)

Having to do this raises a few questions about the design of the tables but ...

Steve

sweidanz_at_yahoo.com wrote:
>
> Is there a better way of doing the following query:
>
> "first get all the records in resultset1 and then get records in
> resultset2 where the records are not in resultset1"
>
Received on Wed Oct 17 2001 - 10:20:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US