A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
UPDATE multiple columns with subquery
Joined: Apr 19, 2002
Mar 06, 2007 13:03:00
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:
subject: UPDATE multiple columns with subquery
XML insert in Oracle
problem in updating tables through hibernate
Statement is closed?
Copying data from 1 column of a table to another
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014