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 -> Union query, sort of

Union query, sort of

From: Randy Harris <notvalid_at_no.spam>
Date: Wed, 13 Apr 2005 00:16:39 GMT
Message-ID: <HxZ6e.1705$716.586@newssvr19.news.prodigy.com>


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 Received on Tue Apr 12 2005 - 19:16:39 CDT

Original text of this message

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