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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Update SQL

Status
Not open for further replies.

DaveL

Programmer
Jun 8, 2000
40
US
Can anyone tell me what I am doing wrong with this basic Update SQL statement?

It seems like a pretty simple problem. I am trying to update a column in FileA (field1) with a column from FileB (field1) where the key fields, field2 and field3, match.

What am I missing?

Thanks!

Code:
UPDATE FileA ;
SET field1= ; 
   (SELECT FileB.field1 FROM FileB WHERE FileB.field2= FileA.field2 AND FileB.field3= FileA.field3) ;
 
The semicolon at the end of each line is new to me - generally I would only expect to see one at the end of the statement:

UPDATE FileA
SET field1= (SELECT FileB.field1
FROM FileB
WHERE FileB.field2= FileA.field2
AND FileB.field3=FileA.field3) ;

Other than that, this looks OK to me. What kind of error/unexpected results are you getting?
 
I am trying to run this SQL statement in a Visual FoxPro 6.0 program. The semicolon is a line continuation character. I wanted to make sure the SQL statement itself looked OK. The problem must be specific to VFP. The error I am getting is "Function Name missing )". I must have a problem before the closing ')' because it looks as if it is not seeing it?

I will post the problem on the VFP forum for ideas.

Thanks for the help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top