Register / Login
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
JDBC and Relational Databases
UPDATE multiple columns with subquery
posted 10 years ago
Suppose I've two tables CUSTOMERHOMEADDRESS and CUSTOMERWORKADDRESS with similar columns.
How do I write one update statement to copy 5-8 columns from CUSTOMERWORKADDRESS into CUSTOMERHOMEADDRESS?
I'd imagine it will take repeated subquery to achieve this:
update customerhomeaddress set address1 = (select address1 from customerworkaddress where customerid = 1235), address2 = (select address2 from customerworkaddress where customerid = 1235), state = (select state from customerworkaddress where customerid = 1235), country= (select country from customerworkaddress where customerid = 1235) where customerid = 1235;
[ March 06, 2007: Message edited by: Chu Tan ]
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
Boost this thread!
XML insert in Oracle
problem in updating tables through hibernate
Statement is closed?
Copying data from 1 column of a table to another