Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Difficult Correlated Update Query

Re: Difficult Correlated Update Query

From: Alex Filonov <afilonov_at_pro-ns.net>
Date: Thu, 30 Nov 2000 20:29:43 GMT
Message-ID: <906dbf$lfh$1@nnrp1.deja.com>

In article <904buf$m9p$1_at_slb3.atl.mindspring.net>,   "David Chasteen" <david_chasteen_at_mindspring.com> wrote:
> How do I update a column in one table with the column value in another
 table
> and have it correlated to the same key. For example:
>
> Table A
> Akey Col1
> 1 a
> 2 b
> 3 c
>
> Table B
> Bkey Col2
> 1 x
> 2 y
> 3 z
>
> I tried:
>
> update A
> set Col1 = (select Col2 from B where Akey = Bkey)

This is correct. You'd better prefix columns in such a statement:

update A
  set Col1 = (select b.col2 from b where b.bkey = a.akey)

>
> and
> update A
> set Col1 = (select Col2 from B where Akey = Bkey)
> where Akey = Bkey
>
> and
>
> update A
> set Col1 = (select Col2 from B)
> where Akey = Bkey
>
> I still haven't figured it out. Does anyone know?
>
> Thanks.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Nov 30 2000 - 14:29:43 CST

Original text of this message

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