Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> MINUS works, but is there a faster way?
Hi,
I have two identical tables, same data types and columns. Currently I use
the following query to select the records that are in the first table but
not the second.
INSERT INTO schema2.tablename
SELECT * FROM schema1.tablename
MINUS
SELECT * FROM schema2.tablename
There are 10 columns in each table and there is a composite index on 4 of the columns. The other six fields contain data that is similar, so I don't think adding another index would help.
I tried
select * form schema1.tablename,schema2.tablename
where
schema1.tablename.column1<>schema2.tablename.column1
and
schema1.tablename.column2<>schema2.tablename.column2
and
schema1.tablename.column3<>schema2.tablename.column3
and
schema1.tablename.column4<>schema2.tablename.column4;
This didn't work!
Schema1 table is imported form a VAX daily, and only has data for two days, schema2 table on NT is for longer term storage of data
What is the proper way to find the all of the records in one table that are not in the second? Received on Wed Dec 23 1998 - 23:57:07 CST