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: [Help] How do i update multiple rows in a table

Re: [Help] How do i update multiple rows in a table

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Tue, 5 Oct 1999 06:56:06 +0200
Message-ID: <939099457.190.0.pluto.d4ee154e@news.demon.nl>


update tablea
set tablea.column2 = (select tableb.column2 where tableb.column1 = tablea.column1)
where tablea.column1 in
(select tableb.column1 from tableb)
The latter subquery is necessary because you would set all rows of tablea, which don't occur in tableb, to NULL.

Hth,

--
Sybrand Bakker, Oracle DBA
Maelstorm <teehjNOteSPAM_at_hotmail.com.invalid> wrote in message news:0a0133f8.71a8df18_at_usw-ex0102-009.remarq.com...
> How do i update multiple rows in a table base on multiple rows of a
> different table. OKie if that is vague.. i write down the sql statement
> which works in sql server.
>
> UPDATE TABLEA, TABLEB SET TABLEACOLUMN2 = TABLEBCOLUMN2
> WHERE TABLE1COLUMN1 = TABLE2COLUMN1
>
> basically what i want is to update table a with whatever data that is
> in table2.
>
> I need to do that in sql statement.
>
> Thanks
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Mon Oct 04 1999 - 23:56:06 CDT

Original text of this message

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