Solved

Select into tb.column from different tb.column

Posted on 2010-11-19
4
225 Views
Last Modified: 2012-05-10
I have two tables, both contain employee_no and other column's, I need to 'copy' only the employee_no column into an existing tb, so that it can be updated with new information, how would I go about doing this?
0
Comment
Question by:JYLWest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34173158
You mean something like:

   INSERT INTO [Table2] ([employee_no])
       SELECT [employee_no] FROM [Table1]

?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34173178
I think you want to UPDATE with JOIN ...
see this article: http://www.experts-exchange.com/A_1517.html
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 34173266
Updates one table with info in another table joined on employee_no. ??

UPDATE a SET
   somecolumn = b.someothercolumn
FROM TableOne a
INNER JOIN TableTwo b ON a.employee_no = b.employee_no
0
 

Author Closing Comment

by:JYLWest
ID: 34831138
managed to come right but very close to where i needed to be.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question