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 -> Re: Updating

Re: Updating

From: Michel Cadot <micadot2removethat_at_free.fr>
Date: Wed, 1 Oct 2003 23:16:15 +0200
Message-ID: <3f7b4361$0$2788$626a54ce@news.free.fr>

"MoneyFool" <gandhikartik_at_yahoo.com> a écrit dans le message de news:d8a7f25e.0310011047.22100ac8_at_posting.google.com...
> I have 2 tables in Oracle database
>
> Table A
> ID Path
> 2 \vfs\gim2k
> 3 \vfs\gim2k
> 4 \vfs\gim2k
> 5 \vfs\gim2k
> 6 \vfs\gim2k
>
> Table B
> ID Path
> 3 menu
> 4 j menu
> 5 q menu
> 6 abc menu
>
> how can I update table A and set the Path to the same from Table B for
> all the ID's common in A and B?
>
> The below one works for 1 id but not multiple?
> update A
> set path = ( select path
> from B
> where id IN ('3'))
> where id IN ('3')
>
> Thanks

If id is a primary key you can use:

update (select a.path patha, b.path pathb from tableA a, tableB b where a.id = b.id) set patha = pathb;

Hope this helps
Michel Cadot Received on Wed Oct 01 2003 - 16:16:15 CDT

Original text of this message

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