I am trying to write a select
statement in Visual Fox Pro 9 (VFP9) to update a row (and eventually several other records, I wrote a select statement first and it worked great, I got the expected result.
But I'm a little new to VFP9 syntax, and who wouldn't be in 2013? I'm expecting the UPDATE
which contains my select
to operate a bit like an UPDATE INNER JOIN
in actual non-foxprose SQL.
SELECT temptable3.constate FROM temptable3, prw22001 ;
WHERE prw22001.empno = temptable3.empno AND temptable3.pssn = prw22001.ssn AND temptable3.empno='5202' AND temptable3.constate <> prw22001.stateid AND prw22001.procyear='2012'
UPDATE prw22001 ;
SET prw22001.stateid = SELECT temptable3.constate FROM temptable3, prw22001 ;
WHERE prw22001.empno = temptable3.empno AND temptable3.pssn = prw22001.ssn AND temptable3.empno='5202' AND temptable3.constate <> prw22001.stateid AND prw22001.procyear='2012'
I get an error that reads Microsoft Visual FoxPro Command contains unrecognized phrase/keyword.
I don't see what it is talking about and a good 4/5ths of my query is my original select statement.
convert your statement like this:
UPDATE prw22001 ;
SET prw22001.stateid = temptable3.constate ;
FROM temptable3, prw22001 ;
WHERE prw22001.empno = temptable3.empno AND temptable3.pssn = prw22001.ssn AND temptable3.empno='5202' AND temptable3.constate <> prw22001.stateid AND prw22001.procyear='2012'