Re: Query Question

From: Mahesh Vallampati <m0v5533_at_tamsun.tamu.edu>
Date: 29 Jul 1994 20:18:23 -0500
Message-ID: <31c9ov$e4v_at_tamsun.tamu.edu>


In article <31c10k$4sa_at_sun.cais.com>, Scott T Johnson <sarek_at_cais2.cais.com> wrote:
>I have a preformance problem. I have two tables: A & B. I need to update
>A from B based on whats already in A.
>A B
>2 1
>4 2
> 3
> 4
> 5
>I need table A to have the same values as B. Values 2 and 4
>cannot be deleted or duplicated. I tried: INSERT INTO A SELECT C1 FROM B
>WHERE C1 NOT IN (SELECT C1 FROM B); This takes forever!! Help!!
>Thanks,
>Scott
Try this



insert into A(c2)
select c1 from b
minus
select c2 from a;

or
insert into A(c2)
select distinct b.c1 from A,B
where A.c2!=b.c1;

Hope this helps.

Thanks and Regards
Mahesh Vallampati
M.S. In EE
Dept.of Electrical Engineering,
Texas A & M University.
Ph:(409)845-6189
\\ In the Beginning there was Codd..... Received on Sat Jul 30 1994 - 03:18:23 CEST

Original text of this message