This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes UPDATE multiple columns with subquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "UPDATE multiple columns with subquery" Watch "UPDATE multiple columns with subquery" New topic

UPDATE multiple columns with subquery

Justin Chu
Ranch Hand

Joined: Apr 19, 2002
Posts: 209
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:

[ March 06, 2007: Message edited by: Chu Tan ]
I agree. Here's the link:
subject: UPDATE multiple columns with subquery
Similar Threads
problem in updating tables through hibernate
Repeatable SQL
Statement is closed?
Copying data from 1 column of a table to another
XML insert in Oracle