This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Multiple Record Update Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Multiple Record Update" Watch "Multiple Record Update" New topic
Author

Multiple Record Update

Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Quick SQL question for the experts out there...

I'm working on a database that has two tables that I'd like to combine into one. Here's the basic structure:



My goal is to just copy the name column from the UserNames table into the Users table, so that I end up with this:



I've already created the Name column within the Users table, but I'm unsure of how to write the SQL query to copy the names over from UserNames to Users. I want to do something like this:



I just need to know what the correct syntax is.

Thanks, folks.


SCJP Tipline, etc.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1318

The correct syntax is.



Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by Saif uddin:
The correct syntax is.



Thank you. Worked like a charm.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Multiple Record Update
 
Similar Threads
Can Arrays be treated as DB tables?
Can't use Optimistic Locking
Problem in composite key as foreign key mapping w/ hibernate v3.2.6 and jdk-6
MySQL field is autoincrememnt - insert?
Transposing rows to columns