Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Statement. help plz

Status
Not open for further replies.

warning99

Programmer
Nov 5, 2007
53
0
0
SA
I have to tables. The first (A) table contain EmployeeNo, EmployeeFirstName, EmployeeLastName, EmployeeNationalty. The second table (B) with same fields but with deffernt values. Now I want to update the first table and take all values from Table B to Table A with keep old information in Table A.

Notes:

1- Table A contain All information for all Employee from EmployeeNo: 1 to EmployeeNo : 700.
2- Table A In field EmployeeNo contain Numbers from 1 to 1000. but another fields to 700.
3- Table B contain all Information for all fields from 701 to 1000.


Now I want copy all data to A. and I can link between A and B because the EmployeeNo is there in all tables.
 
I'm not sure I understand what you are looking for, coudl you give an example of the data in bothtables and how you want the data to appear in the end result?

"NOTHING is more important in a database than integrity." ESquared
 
Not sure if this is what you're after...


update tableA
set tableA.EmployeeFirstName = TableB.EmployeeFirstName, tableA.EmployeeLastName = TableB.EmployeeLastName, tableA.EmployeeNationalty = tableb.EmployeeNationalty
where tableA.EmployeeNo = tableb.EmployeeNo
and tableA.EmployeeNo > 700
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top