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 -> MINUS works, but is there a faster way?

MINUS works, but is there a faster way?

From: John Mason Jr <masonj_at_erols.com>
Date: Thu, 24 Dec 1998 00:57:07 -0500
Message-ID: <75sl3g$avi$1@winter.news.rcn.net>


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

Original text of this message

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