Home » SQL & PL/SQL » SQL & PL/SQL » Updating tables
Updating tables [message #8725] Mon, 22 September 2003 02:28 Go to next message
Rehman
Messages: 19
Registered: February 2000
Junior Member
HOW CAN I UPDATE TABLE

TABLE1
f1 f2 f3 f4
--- -------- ----
09 101 1 B1
09 101 2 B1
09 101 3 B1
09 101 4 B1
09 101 5 B1
09 101 6 B1
09 101 7 B1
09 101 8 B1
09 101 9 B1
(f2 AND f3 ARE PRIMARY KEYS)

TABLE 2

f1 f2 f3 f4
--- -------- ------
09 101 1
09 101 2
09 101 3
09 101 4
09 101 5
09 101 6
09 101 7
09 101 8
09 101 9
(f2 AND f3 are primary keys)

I WANT TO UPDATE TABLE2 F4 VALUES CORRESPONDING TO
TABLE1 F4 values
Re: Updating tables [message #8729 is a reply to message #8725] Mon, 22 September 2003 04:16 Go to previous message
Rajarshi Dasgupta
Messages: 52
Registered: October 2001
Member
Here's the update statement...

update table2 t2
set f4 = (select f4 from table1 t1
where t1.f2 = t2.f2
and t1.f3 = t2.f3);

Hope this helps.
Previous Topic: How to see the query exuecuted by EXEC IMMEDIATE
Next Topic: How to call a exe in a trigger?
Goto Forum:
  


Current Time: Fri Apr 26 10:05:39 CDT 2024