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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Union query, sort of

Re: Union query, sort of

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Tue, 12 Apr 2005 21:36:37 -0700
Message-ID: <1113366769.917661@yasure>


Randy Harris wrote:

> Is it possible to Union on less than all of the columns?
>
> SELECT col1, col2, col3
> FROM table1
> UNION
> SELECT col1, col2, col3
> FROM table2
>
> Will give me all of the distinct records from both queries (no duplicates).
> But what I need is all of the records where (col1, col2) are unique. If
> they match between tables, but col3 doesn't, then include only the record
> from table1. Is that possible in Oracle 8.1.7.4?
>
> table1
> house blue 3
> boat green 5
> pool yellow 6
>
> table2
> house blue 3
> boat green 2
> pool white 6
>
> desired output:
> house blue 3
> boat green 5
> pool yellow 6
> pool white 6
>
> Thanks in advance for any help

No. Wrong solution to the problem.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Tue Apr 12 2005 - 23:36:37 CDT

Original text of this message

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