Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| 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
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #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.
Reply With Quote
  #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
Reply With Quote
  #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.
Reply With Quote
Reply


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
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



All times are GMT -4. The time now is 07:58 AM.


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