Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Updating
"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