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
Solved

Select into tb.column from different tb.column

Posted on 2010-11-19
4
223 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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