Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 23rd, 2006, 01:48 AM
Authorized User
Join Date: Oct 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Update one table with other table data?


Table 1
EId FirstName LastName
1 sdf df
2 sdf sdf
3 sdfd sdfsdf

Table 2
EId FirstName LastName

How to update Table2's firstname and lastname column data using table1's data?

Ramkumar A.D.

Ramkumar A D
Reply With Quote
  #2 (permalink)  
Old May 25th, 2006, 02:14 PM
Registered User
Join Date: May 2006
Location: Renton, Washington, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts


Try this SQL statement:

UPDATE TBL, tblEmployees SET TBL.Firstname = TBL!Firstname, TBL.Lastname = [TBL]![Lastname]
WHERE (((TBL.Firstname)=[tblEmployees]![FirstName]) AND ((TBL.Lastname)=[tblEmployees]![LastName]));

TBL was a test table I set up in Access to make sure it worked. It does. I hope this helps. I don't know what type of RDBMS you are using but this does work in Access.

Jack Britton

Reply With Quote
  #3 (permalink)  
Old May 26th, 2006, 12:51 AM
Authorized User
Join Date: Oct 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts


I am using SQL Server 2000 for this and the reply that i got is:

update table2 set firstname=table1.firstname, lastname=table1.lastname from table1,table2
where table1.eid=table2.eid

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update one table to another table using DTS in SQL Printmaker SQL Language 0 July 24th, 2007 07:17 AM
Update data from another table Sheikha SQL Language 1 July 11th, 2005 05:32 AM
update table with an ID Num from different table scoobie PHP How-To 12 January 25th, 2005 12:28 PM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM
Update SQL table with data from FoxPro system sofya SQL Server 2000 6 November 4th, 2004 06:45 PM

All times are GMT -4. The time now is 09:16 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.