Register / Login
File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
JDBC and Relational Databases
UPDATE multiple columns with subquery
posted 8 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 ]
I agree. Here's the link:
XML insert in Oracle
problem in updating tables through hibernate
Statement is closed?
Copying data from 1 column of a table to another