Home » RDBMS Server » Server Administration » update multiple fields
update multiple fields [message #374470] Wed, 13 June 2001 17:36 Go to next message
ginger
Messages: 2
Registered: June 2001
Junior Member
i'm just a beginner in oracle. can anyone help me how to update multiple fields which relates to multiple table...

here is my SQL statement:

select a.id,
b.address,
b.name,
c.date
from TABLE1 a,
TABLE2 b,
TABLE3 c
where a.id = b.id
and b.id = c.id
and c.date > '29-MAY-2001'
and a.tag = 'Y'
and c.update = 'Y'

i want to update TABLE1 with the output on my SQL Statement.

i need answer asap. thanks so much!
Re: update multiple fields [message #374485 is a reply to message #374470] Thu, 14 June 2001 08:18 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi,

update table1 set
(address, name, date) =
(select
b.address,
b.name,
c.date
from TABLE1 a,
TABLE2 b,
TABLE3 c
where a.id = b.id
and b.id = c.id
and c.date > '29-MAY-2001'
and a.tag = 'Y'
and c.update = 'Y');

ID is the primary key for table1?

you can not update primary key, thats why i removed it from update and select statements.
Re: update multiple fields [message #374512 is a reply to message #374470] Fri, 15 June 2001 13:34 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Thanks Bala.. you're a genious :)
Re: update multiple fields [message #374513 is a reply to message #374470] Fri, 15 June 2001 13:35 Go to previous message
ginger
Messages: 2
Registered: June 2001
Junior Member
Thanks Bala.. you're a genious :)
Previous Topic: Selecting an alpha character from a varchar2 field containing mostly numbers
Next Topic: Describing all the tables in a database
Goto Forum:
  


Current Time: Mon Dec 23 14:03:01 CST 2024