File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Sample SQL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Sample SQL question" Watch "Sample SQL question" New topic

Sample SQL question

Alex gRin

Joined: Nov 21, 2009
Posts: 3
I have a table that kind of looks like this

And another table that looks like this

What is the right query to take the firstname lastname from table one and insert it to table 2 so that the name matches with id and would look like this

I tried one query before but it does not matches the info

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

What's the question?

[My Blog] [JavaRanch Journal]
Venus Ong

Joined: Dec 10, 2009
Posts: 7
Hello Alex

I think you may want to explore the Merge function of SQL for this case.

I agree. Here's the link:
subject: Sample SQL question
It's not a secret anymore!