>I have a table with three fields, including one logical. I want to change the logical to .T. for every record that contains a unique entry. I've tried REPLACE MyTABLE.FIELD3 WITH .T. FOR (SELECT DISTINCT FIELD2 FROM MyTABLE) but I get a "Function name is missing )." What am I doing wrong?
Hi Peter,
Your FOR clause is wrong.
First, REPLACE does not support such a syntax for it, instead you may use SQL UPDATE for this, something like:
UPDATE myTable SET mytable.field3 = .t. WHERE field2 in (SELECT field2 from myTable GROUP BY Fileld2)
(this is not tested, but you get an idea)
Second, DISTINCT is related to distinct records as a whole, not fields. (I am not quite sure if you meant DISTINCT for the record or for the field).
Third, anyway the condition you were trying to use after FOR should look like
WHERE
myfield in (SELECT somefield FROM sometable)
Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison