Register / Login
JDBC and Relational Databases
UPDATE multiple columns with subquery
posted 9 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 ]
XML insert in Oracle
problem in updating tables through hibernate
Statement is closed?
Copying data from 1 column of a table to another