Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 8th, 2011, 11:47 AM
Registered User
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default "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
  #2 (permalink)  
Old February 9th, 2011, 03:46 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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
__________________
Always,
Hovik Melkomian.
  #3 (permalink)  
Old February 9th, 2011, 04:55 AM
Registered User
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #4 (permalink)  
Old February 10th, 2011, 06:51 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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
__________________
Always,
Hovik Melkomian.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Java code for "print screen copy and paste" should act as an attachement on jsp. Dev programmer Java Basics 0 December 13th, 2010 06:26 AM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Code not going as planned: "icicle" vs "savedinstancestate" joopthecat BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 3 May 3rd, 2009 03:09 PM





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