General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>In Access, my husband updated the values in one table based on the values in another table by putting a JOIN in the SQL. I figured it would be the same in VFP, but I can't figure out how to do it. I don't remember his exact syntax, so I don't know if I'm doing it wrong, or if VFP doesn't support this.
>
>Basically, I'm trying to do:
>
>UPDATE table1
>SET table1.field1 = table2.field2
>WHERE table1.key = table2.key
>
>So how do I do this?
>
>Thanks,
>
>-Michelle
As Don mentioned, VFP's SQL update is not exactly SQL-standard in that it doesn't support what you want to do. Multi-row update support would be nice, too. An alternative to your situation is to use the seek() function on your Where clause like so:
UPDATE Table1 SET tbl1.fld1 = tbl2.fld2 WHERE Seek(tbl1.keyfld1, "tbl2")
Of course you would need the index on the second table. HTH
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only