Are you looking to find rows where:
A). the primary key is different, but all the rest of the data is the same (so a row from table1 is related to a row in table2).
or are you looking for:Code:15:01:53 SQL> create table temp_table1 (cust_num number(4), 15:03:03 2 favourite_colour varchar2(10), 15:03:03 3 favourite_car varchar2(10), 15:03:03 4 constraint temp_table1_pk 15:03:03 5 primary key (cust_num)); Table created. 15:03:40 SQL> create table temp_table2 (cust_num number(4), 15:03:50 2 favourite_colour varchar2(10), 15:03:50 3 favourite_car varchar2(10), 15:03:50 4 constraint temp_table2_pk 15:03:50 5 primary key (cust_num)); Table created. 15:20:06 SQL> select * from temp_table1; CUST_NUM FAVOURITE_ FAVOURITE_ ---------- ---------- ---------- 1 red porsche 2 blue ferrari 4 orange Skoda 15:20:19 SQL> select * from temp_table2; CUST_NUM FAVOURITE_ FAVOURITE_ ---------- ---------- ---------- 1 red porsche 3 blue ferrari 5 orange Beetle 15:20:39 SQL> select a.*, b.* 15:20:57 2 from (select * from temp_table1 where cust_num not in( 15:20:57 3 select cust_num from temp_table2)) a, 15:20:57 4 (select * from temp_table2 where cust_num not in( 15:20:57 5 select cust_num from temp_table1)) b 15:20:57 6 where a.favourite_colour=b.favourite_colour 15:20:57 7 and a.favourite_car=b.favourite_car; CUST_NUM FAVOURITE_ FAVOURITE_ CUST_NUM FAVOURITE_ FAVOURITE_ ---------- ---------- ---------- ---------- ---------- ---------- 2 blue ferrari 3 blue ferrari 15:20:58 SQL>
B). Any row that that is in one table, but not in the other and the rows bear no relation to each other?...




Reply With Quote