Solved

Select into tb.column from different tb.column

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

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
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 remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now