p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Language (http://p2p.wrox.com/forumdisplay.php?f=100)
-   -   "copy" column from one table to another (http://p2p.wrox.com/showthread.php?t=82526)

balushen February 8th, 2011 11:47 AM

"copy" column from one table to another
 
Hello,

Im using FoxPro 6 and I have 2 tables, both with 2 columns. The first one (A) has one column filled with ids and the second column is empty. The second table (B) has also the same ids and its second column has some values. My question is how can I insert the values from table B into table A (for the same id of course).

Thank you in advance.
Peter

melvik February 9th, 2011 03:46 AM

well Im not sure about FoxPro (I used to work with DOS) but its the SQL
Code:

UPDATE TableA SET Column2 = B.Column2
FROM TableA A INNER JOIN TableB B ON A.Id = B.Id

or if im still remembering FoxPro, u cant use INNER so it might be sth like

Code:

UPDATE TableA SET Column2 = B.Column2
FROM TableA A ,TableB B
WHERE A.Id = B.Id

HtH

balushen February 9th, 2011 04:55 AM

You can use INNER, but I already tried that and both variants get me an error message "Command contains unrecognized phrase/keyword" and I think its because of the stupid foxpro and Im out of ideas [:(]

melvik February 10th, 2011 06:51 AM

what version of Foxpro r u using? is it DOS? or Visual FoxPro?
plz replace the Table Name & column name
if u did run the exact phrase

Code:

UPDATE TableA SET Column2 = B.Column2
FROM TableA A INNER JOIN TableB B ON A.Id = B.Id



All times are GMT -4. The time now is 06:51 PM.

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